This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new f71bb5a44c Differentiate trace and debug log levels f71bb5a44c is described below commit f71bb5a44c71781394d379ac1ccbb8d5d360e4f0 Author: remm <r...@apache.org> 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 c01943871c..e6d170c260 100644 --- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java +++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java @@ -1163,8 +1163,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()) { @@ -1180,8 +1180,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 ec6c13ff6b..1c018e60a0 100644 --- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java +++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java @@ -622,8 +622,8 @@ public class Nio2Endpoint extends AbstractJsseEndpoint<Nio2Channel,AsynchronousS this.readCompletionHandler = new CompletionHandler<Integer, ByteBuffer>() { @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) { @@ -835,8 +835,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) { @@ -857,8 +857,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; } @@ -891,8 +891,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; } @@ -921,8 +921,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; } @@ -949,14 +949,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 @@ -973,8 +973,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()); @@ -1435,8 +1435,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()) { @@ -1465,8 +1465,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 8ef737ae7e..5525c74af0 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -318,8 +318,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) { @@ -335,8 +335,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())); } } @@ -865,8 +865,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 { @@ -879,15 +879,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"); } poller.cancelledKey(sk, socketWrapper); 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)) { poller.cancelledKey(sk, socketWrapper); @@ -895,8 +895,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; @@ -905,8 +905,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); @@ -917,7 +917,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) { poller.cancelledKey(sk, socketWrapper); @@ -1132,15 +1132,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(); @@ -1156,8 +1156,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()); @@ -1371,8 +1371,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); } @@ -1380,8 +1380,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); } @@ -1548,8 +1548,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 459137e871..80096da87c 100644 --- a/java/org/apache/tomcat/util/net/SecureNio2Channel.java +++ b/java/org/apache/tomcat/util/net/SecureNio2Channel.java @@ -426,8 +426,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 ff6fb548ce..b169e4c9d6 100644 --- a/java/org/apache/tomcat/util/net/SecureNioChannel.java +++ b/java/org/apache/tomcat/util/net/SecureNioChannel.java @@ -301,8 +301,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 c8f503185c..472c4fabea 100644 --- a/java/org/apache/tomcat/util/net/SocketWrapperBase.java +++ b/java/org/apache/tomcat/util/net/SocketWrapperBase.java @@ -380,8 +380,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; @@ -394,8 +394,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 0133c8da29..82b01e775c 100644 --- a/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java +++ b/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java @@ -109,8 +109,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 | @@ -218,8 +218,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); @@ -231,8 +231,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))); } } @@ -258,8 +258,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); @@ -271,8 +271,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))); } } @@ -406,8 +406,8 @@ public class OpenSSLContext implements org.apache.tomcat.util.net.SSLContext { OpenSSLConf openSslConf = sslHostConfig.getOpenSslConf(); if (openSslConf != null && 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, cctx)) { @@ -417,8 +417,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, cctx, ctx)) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org