This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new 5d22c85c15 Differentiate trace and debug log levels
5d22c85c15 is described below
commit 5d22c85c150fbc1abed4ec809f4373fcfb49fd9c
Author: remm <[email protected]>
AuthorDate: Tue Feb 6 11:08:42 2024 +0100
Differentiate trace and debug log levels
---
.../apache/tomcat/util/net/AbstractEndpoint.java | 8 ++--
java/org/apache/tomcat/util/net/Nio2Endpoint.java | 40 ++++++++--------
java/org/apache/tomcat/util/net/NioEndpoint.java | 54 +++++++++++-----------
.../apache/tomcat/util/net/SecureNio2Channel.java | 4 +-
.../apache/tomcat/util/net/SecureNioChannel.java | 4 +-
.../apache/tomcat/util/net/SocketWrapperBase.java | 8 ++--
.../tomcat/util/net/openssl/OpenSSLContext.java | 28 +++++------
7 files changed, 73 insertions(+), 73 deletions(-)
diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
index 43d5ee4f94..8602b8ae7f 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -1117,8 +1117,8 @@ public abstract class AbstractEndpoint<S,U> {
// That causes delays when running the unit tests. Explicitly
enableing linger but with a timeout of
// zero seconds seems to fix the issue.
s.setSoLinger(true, 0);
- if (getLog().isDebugEnabled()) {
- getLog().debug("About to unlock socket for:" +
unlockAddress);
+ if (getLog().isTraceEnabled()) {
+ getLog().trace("About to unlock socket for:" +
unlockAddress);
}
s.connect(unlockAddress,utmo);
if (getDeferAccept()) {
@@ -1134,8 +1134,8 @@ public abstract class AbstractEndpoint<S,U> {
"User-Agent: Tomcat wakeup connection\r\n\r\n");
sw.flush();
}
- if (getLog().isDebugEnabled()) {
- getLog().debug("Socket unlock completed for:" +
unlockAddress);
+ if (getLog().isTraceEnabled()) {
+ getLog().trace("Socket unlock completed for:" +
unlockAddress);
}
}
// Wait for up to 1000ms acceptor threads to unlock. Particularly
diff --git a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
index b10f1cc510..69c4540d9d 100644
--- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java
+++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java
@@ -608,8 +608,8 @@ public class Nio2Endpoint extends
AbstractJsseEndpoint<Nio2Channel,AsynchronousS
this.readCompletionHandler = new CompletionHandler<>() {
@Override
public void completed(Integer nBytes, ByteBuffer attachment) {
- if (log.isDebugEnabled()) {
- log.debug("Socket: [" + Nio2SocketWrapper.this + "],
Interest: [" + readInterest + "]");
+ if (log.isTraceEnabled()) {
+ log.trace("Socket: [" + Nio2SocketWrapper.this + "],
Interest: [" + readInterest + "]");
}
boolean notify = false;
synchronized (readCompletionHandler) {
@@ -821,8 +821,8 @@ public class Nio2Endpoint extends
AbstractJsseEndpoint<Nio2Channel,AsynchronousS
public int read(boolean block, byte[] b, int off, int len) throws
IOException {
checkError();
- if (log.isDebugEnabled()) {
- log.debug("Socket: [" + this + "], block: [" + block + "],
length: [" + len + "]");
+ if (log.isTraceEnabled()) {
+ log.trace("Socket: [" + this + "], block: [" + block + "],
length: [" + len + "]");
}
if (socketBufferHandler == null) {
@@ -843,8 +843,8 @@ public class Nio2Endpoint extends
AbstractJsseEndpoint<Nio2Channel,AsynchronousS
}
} else {
if (!readPending.tryAcquire()) {
- if (log.isDebugEnabled()) {
- log.debug("Socket: [" + this + "], Read in
progress. Returning [0]");
+ if (log.isTraceEnabled()) {
+ log.trace("Socket: [" + this + "], Read in
progress. Returning [0]");
}
return 0;
}
@@ -877,8 +877,8 @@ public class Nio2Endpoint extends
AbstractJsseEndpoint<Nio2Channel,AsynchronousS
} else if (nRead == 0 && !block) {
readInterest = true;
}
- if (log.isDebugEnabled()) {
- log.debug("Socket: [" + this + "], Read: [" + nRead + "]");
+ if (log.isTraceEnabled()) {
+ log.trace("Socket: [" + this + "], Read: [" + nRead + "]");
}
return nRead;
}
@@ -907,8 +907,8 @@ public class Nio2Endpoint extends
AbstractJsseEndpoint<Nio2Channel,AsynchronousS
}
} else {
if (!readPending.tryAcquire()) {
- if (log.isDebugEnabled()) {
- log.debug("Socket: [" + this + "], Read in
progress. Returning [0]");
+ if (log.isTraceEnabled()) {
+ log.trace("Socket: [" + this + "], Read in
progress. Returning [0]");
}
return 0;
}
@@ -935,14 +935,14 @@ public class Nio2Endpoint extends
AbstractJsseEndpoint<Nio2Channel,AsynchronousS
if (block && to.remaining() >= limit) {
to.limit(to.position() + limit);
nRead = fillReadBuffer(block, to);
- if (log.isDebugEnabled()) {
- log.debug("Socket: [" + this + "], Read direct from
socket: [" + nRead + "]");
+ if (log.isTraceEnabled()) {
+ log.trace("Socket: [" + this + "], Read direct from
socket: [" + nRead + "]");
}
} else {
// Fill the read buffer as best we can.
nRead = fillReadBuffer(block);
- if (log.isDebugEnabled()) {
- log.debug("Socket: [" + this + "], Read into buffer:
[" + nRead + "]");
+ if (log.isTraceEnabled()) {
+ log.trace("Socket: [" + this + "], Read into buffer:
[" + nRead + "]");
}
// Fill as much of the remaining byte array as possible
with the
// data that was just read
@@ -959,8 +959,8 @@ public class Nio2Endpoint extends
AbstractJsseEndpoint<Nio2Channel,AsynchronousS
@Override
protected void doClose() {
- if (log.isDebugEnabled()) {
- log.debug("Calling [" + getEndpoint() + "].closeSocket([" +
this + "])");
+ if (log.isTraceEnabled()) {
+ log.trace("Calling [" + getEndpoint() + "].closeSocket([" +
this + "])");
}
try {
getEndpoint().connections.remove(getSocket().getIOChannel());
@@ -1383,8 +1383,8 @@ public class Nio2Endpoint extends
AbstractJsseEndpoint<Nio2Channel,AsynchronousS
if (readNotify) {
return;
}
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("endpoint.debug.registerRead",
this));
+ if (log.isTraceEnabled()) {
+ log.trace(sm.getString("endpoint.debug.registerRead",
this));
}
readInterest = true;
if (readPending.tryAcquire()) {
@@ -1413,8 +1413,8 @@ public class Nio2Endpoint extends
AbstractJsseEndpoint<Nio2Channel,AsynchronousS
if (writeNotify) {
return;
}
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("endpoint.debug.registerWrite",
this));
+ if (log.isTraceEnabled()) {
+ log.trace(sm.getString("endpoint.debug.registerWrite",
this));
}
writeInterest = true;
if (writePending.availablePermits() == 1) {
diff --git a/java/org/apache/tomcat/util/net/NioEndpoint.java
b/java/org/apache/tomcat/util/net/NioEndpoint.java
index 6659ba2298..bf3633806d 100644
--- a/java/org/apache/tomcat/util/net/NioEndpoint.java
+++ b/java/org/apache/tomcat/util/net/NioEndpoint.java
@@ -341,8 +341,8 @@ public class NioEndpoint extends
AbstractJsseEndpoint<NioChannel,SocketChannel>
*/
@Override
public void unbind() throws Exception {
- if (log.isDebugEnabled()) {
- log.debug("Destroy initiated for " +
+ if (log.isTraceEnabled()) {
+ log.trace("Destroy initiated for " +
new InetSocketAddress(getAddress(),getPortWithOffset()));
}
if (running) {
@@ -358,8 +358,8 @@ public class NioEndpoint extends
AbstractJsseEndpoint<NioChannel,SocketChannel>
if (getHandler() != null ) {
getHandler().recycle();
}
- if (log.isDebugEnabled()) {
- log.debug("Destroy completed for " +
+ if (log.isTraceEnabled()) {
+ log.trace("Destroy completed for " +
new InetSocketAddress(getAddress(), getPortWithOffset()));
}
}
@@ -902,8 +902,8 @@ public class NioEndpoint extends
AbstractJsseEndpoint<NioChannel,SocketChannel>
}
}
if (sd.length <= 0 && sc.getOutboundRemaining()<=0) {
- if (log.isDebugEnabled()) {
- log.debug("Send file complete for: " + sd.fileName);
+ if (log.isTraceEnabled()) {
+ log.trace("Send file complete for: " + sd.fileName);
}
socketWrapper.setSendfileData(null);
try {
@@ -916,15 +916,15 @@ public class NioEndpoint extends
AbstractJsseEndpoint<NioChannel,SocketChannel>
if (!calledByProcessor) {
switch (sd.keepAliveState) {
case NONE: {
- if (log.isDebugEnabled()) {
- log.debug("Send file connection is being
closed");
+ if (log.isTraceEnabled()) {
+ log.trace("Send file connection is being
closed");
}
socketWrapper.close();
break;
}
case PIPELINED: {
- if (log.isDebugEnabled()) {
- log.debug("Connection is keep alive,
processing pipe-lined data");
+ if (log.isTraceEnabled()) {
+ log.trace("Connection is keep alive,
processing pipe-lined data");
}
if (!processSocket(socketWrapper,
SocketEvent.OPEN_READ, true)) {
socketWrapper.close();
@@ -932,8 +932,8 @@ public class NioEndpoint extends
AbstractJsseEndpoint<NioChannel,SocketChannel>
break;
}
case OPEN: {
- if (log.isDebugEnabled()) {
- log.debug("Connection is keep alive,
registering back for OP_READ");
+ if (log.isTraceEnabled()) {
+ log.trace("Connection is keep alive,
registering back for OP_READ");
}
reg(sk, socketWrapper, SelectionKey.OP_READ);
break;
@@ -942,8 +942,8 @@ public class NioEndpoint extends
AbstractJsseEndpoint<NioChannel,SocketChannel>
}
return SendfileState.DONE;
} else {
- if (log.isDebugEnabled()) {
- log.debug("OP_WRITE for sendfile: " + sd.fileName);
+ if (log.isTraceEnabled()) {
+ log.trace("OP_WRITE for sendfile: " + sd.fileName);
}
if (calledByProcessor) {
add(socketWrapper, SelectionKey.OP_WRITE);
@@ -954,7 +954,7 @@ public class NioEndpoint extends
AbstractJsseEndpoint<NioChannel,SocketChannel>
}
} catch (IOException e) {
if (log.isDebugEnabled()) {
- log.debug("Unable to complete sendfile request:", e);
+ log.debug(sm.getString("endpoint.sendfile.error"), e);
}
if (!calledByProcessor && sc != null) {
socketWrapper.close();
@@ -1182,15 +1182,15 @@ public class NioEndpoint extends
AbstractJsseEndpoint<NioChannel,SocketChannel>
if (to.remaining() >= limit) {
to.limit(to.position() + limit);
nRead = fillReadBuffer(block, to);
- if (log.isDebugEnabled()) {
- log.debug("Socket: [" + this + "], Read direct from
socket: [" + nRead + "]");
+ if (log.isTraceEnabled()) {
+ log.trace("Socket: [" + this + "], Read direct from
socket: [" + nRead + "]");
}
updateLastRead();
} else {
// Fill the read buffer as best we can.
nRead = fillReadBuffer(block);
- if (log.isDebugEnabled()) {
- log.debug("Socket: [" + this + "], Read into buffer: [" +
nRead + "]");
+ if (log.isTraceEnabled()) {
+ log.trace("Socket: [" + this + "], Read into buffer: [" +
nRead + "]");
}
updateLastRead();
@@ -1206,8 +1206,8 @@ public class NioEndpoint extends
AbstractJsseEndpoint<NioChannel,SocketChannel>
@Override
protected void doClose() {
- if (log.isDebugEnabled()) {
- log.debug("Calling [" + getEndpoint() + "].closeSocket([" +
this + "])");
+ if (log.isTraceEnabled()) {
+ log.trace("Calling [" + getEndpoint() + "].closeSocket([" +
this + "])");
}
try {
getEndpoint().connections.remove(getSocket().getIOChannel());
@@ -1421,8 +1421,8 @@ public class NioEndpoint extends
AbstractJsseEndpoint<NioChannel,SocketChannel>
@Override
public void registerReadInterest() {
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("endpoint.debug.registerRead", this));
+ if (log.isTraceEnabled()) {
+ log.trace(sm.getString("endpoint.debug.registerRead", this));
}
getPoller().add(this, SelectionKey.OP_READ);
}
@@ -1430,8 +1430,8 @@ public class NioEndpoint extends
AbstractJsseEndpoint<NioChannel,SocketChannel>
@Override
public void registerWriteInterest() {
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("endpoint.debug.registerWrite", this));
+ if (log.isTraceEnabled()) {
+ log.trace(sm.getString("endpoint.debug.registerWrite", this));
}
getPoller().add(this, SelectionKey.OP_WRITE);
}
@@ -1594,8 +1594,8 @@ public class NioEndpoint extends
AbstractJsseEndpoint<NioChannel,SocketChannel>
if (!completionDone) {
// This filters out same notification until
processing
// of the current one is done
- if (log.isDebugEnabled()) {
- log.debug("Skip concurrent " + (read ?
"read" : "write") + " notification");
+ if (log.isTraceEnabled()) {
+ log.trace("Skip concurrent " + (read ?
"read" : "write") + " notification");
}
return;
}
diff --git a/java/org/apache/tomcat/util/net/SecureNio2Channel.java
b/java/org/apache/tomcat/util/net/SecureNio2Channel.java
index 474ad033f2..076f336bb8 100644
--- a/java/org/apache/tomcat/util/net/SecureNio2Channel.java
+++ b/java/org/apache/tomcat/util/net/SecureNio2Channel.java
@@ -424,8 +424,8 @@ public class SecureNio2Channel extends Nio2Channel {
throw new IOException(sm.getString("channel.nio.ssl.foundHttp"));
}
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("channel.nio.ssl.sniHostName", sc,
hostName));
+ if (log.isTraceEnabled()) {
+ log.trace(sm.getString("channel.nio.ssl.sniHostName", sc,
hostName));
}
sslEngine = endpoint.createSSLEngine(hostName, clientRequestedCiphers,
diff --git a/java/org/apache/tomcat/util/net/SecureNioChannel.java
b/java/org/apache/tomcat/util/net/SecureNioChannel.java
index 863b6215df..f3238f9c99 100644
--- a/java/org/apache/tomcat/util/net/SecureNioChannel.java
+++ b/java/org/apache/tomcat/util/net/SecureNioChannel.java
@@ -299,8 +299,8 @@ public class SecureNioChannel extends NioChannel {
throw new IOException(sm.getString("channel.nio.ssl.foundHttp"));
}
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("channel.nio.ssl.sniHostName", sc,
hostName));
+ if (log.isTraceEnabled()) {
+ log.trace(sm.getString("channel.nio.ssl.sniHostName", sc,
hostName));
}
sslEngine = endpoint.createSSLEngine(hostName, clientRequestedCiphers,
diff --git a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
index ae6ee0e019..03a13fd90e 100644
--- a/java/org/apache/tomcat/util/net/SocketWrapperBase.java
+++ b/java/org/apache/tomcat/util/net/SocketWrapperBase.java
@@ -369,8 +369,8 @@ public abstract class SocketWrapperBase<E> {
remaining = Math.min(remaining, len);
readBuffer.get(b, off, remaining);
- if (log.isDebugEnabled()) {
- log.debug("Socket: [" + this + "], Read from buffer: [" +
remaining + "]");
+ if (log.isTraceEnabled()) {
+ log.trace("Socket: [" + this + "], Read from buffer: [" +
remaining + "]");
}
}
return remaining;
@@ -383,8 +383,8 @@ public abstract class SocketWrapperBase<E> {
socketBufferHandler.configureReadBufferForRead();
int nRead = transfer(socketBufferHandler.getReadBuffer(), to);
- if (log.isDebugEnabled()) {
- log.debug("Socket: [" + this + "], Read from buffer: [" + nRead +
"]");
+ if (log.isTraceEnabled()) {
+ log.trace("Socket: [" + this + "], Read from buffer: [" + nRead +
"]");
}
return nRead;
}
diff --git a/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java
b/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java
index 11f15589e5..f1d7b092ec 100644
--- a/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java
+++ b/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java
@@ -104,8 +104,8 @@ public class OpenSSLContext implements
org.apache.tomcat.util.net.SSLContext {
OpenSSLConf openSslConf = sslHostConfig.getOpenSslConf();
if (openSslConf != null) {
try {
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("openssl.makeConf"));
+ if (log.isTraceEnabled()) {
+ log.trace(sm.getString("openssl.makeConf"));
}
cctx = SSLConf.make(aprPool,
SSL.SSL_CONF_FLAG_FILE |
@@ -212,8 +212,8 @@ public class OpenSSLContext implements
org.apache.tomcat.util.net.SSLContext {
result = false;
continue;
}
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("opensslconf.checkCommand", name,
value));
+ if (log.isTraceEnabled()) {
+ log.trace(sm.getString("opensslconf.checkCommand", name,
value));
}
try {
rc = SSLConf.check(cctx, name, value);
@@ -225,8 +225,8 @@ public class OpenSSLContext implements
org.apache.tomcat.util.net.SSLContext {
log.error(sm.getString("opensslconf.failedCommand", name,
value,
Integer.toString(rc)));
result = false;
- } else if (log.isDebugEnabled()) {
- log.debug(sm.getString("opensslconf.resultCommand", name,
value,
+ } else if (log.isTraceEnabled()) {
+ log.trace(sm.getString("opensslconf.resultCommand", name,
value,
Integer.toString(rc)));
}
}
@@ -252,8 +252,8 @@ public class OpenSSLContext implements
org.apache.tomcat.util.net.SSLContext {
result = false;
continue;
}
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("opensslconf.applyCommand", name,
value));
+ if (log.isTraceEnabled()) {
+ log.trace(sm.getString("opensslconf.applyCommand", name,
value));
}
try {
rc = SSLConf.apply(cctx, name, value);
@@ -265,8 +265,8 @@ public class OpenSSLContext implements
org.apache.tomcat.util.net.SSLContext {
log.error(sm.getString("opensslconf.failedCommand", name,
value,
Integer.toString(rc)));
result = false;
- } else if (log.isDebugEnabled()) {
- log.debug(sm.getString("opensslconf.resultCommand", name,
value,
+ } else if (log.isTraceEnabled()) {
+ log.trace(sm.getString("opensslconf.resultCommand", name,
value,
Integer.toString(rc)));
}
}
@@ -397,8 +397,8 @@ public class OpenSSLContext implements
org.apache.tomcat.util.net.SSLContext {
OpenSSLConf openSslConf = sslHostConfig.getOpenSslConf();
if (openSslConf != null && state.cctx != 0) {
// Check OpenSSLConfCmd if used
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("openssl.checkConf"));
+ if (log.isTraceEnabled()) {
+ log.trace(sm.getString("openssl.checkConf"));
}
try {
if (!checkConf(openSslConf, state.cctx)) {
@@ -408,8 +408,8 @@ public class OpenSSLContext implements
org.apache.tomcat.util.net.SSLContext {
} catch (Exception e) {
throw new Exception(sm.getString("openssl.errCheckConf"),
e);
}
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("openssl.applyConf"));
+ if (log.isTraceEnabled()) {
+ log.trace(sm.getString("openssl.applyConf"));
}
try {
if (!applyConf(openSslConf, state.cctx, state.ctx)) {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]