This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 9.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push: new ac8c8002d0 Differentiate trace and debug log levels ac8c8002d0 is described below commit ac8c8002d08d06ddf747782fdfba9643a962a96f 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 002c4b7da8..53fcea14b7 100644 --- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java +++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java @@ -1169,8 +1169,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()) { @@ -1186,8 +1186,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 53733cd93a..b2966ac5b6 100644 --- a/java/org/apache/tomcat/util/net/Nio2Endpoint.java +++ b/java/org/apache/tomcat/util/net/Nio2Endpoint.java @@ -619,8 +619,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) { @@ -832,8 +832,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) { @@ -854,8 +854,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; } @@ -888,8 +888,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; } @@ -918,8 +918,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; } @@ -946,14 +946,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 @@ -970,8 +970,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()); @@ -1432,8 +1432,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()) { @@ -1462,8 +1462,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 efa46b7c26..79f05719cc 100644 --- a/java/org/apache/tomcat/util/net/NioEndpoint.java +++ b/java/org/apache/tomcat/util/net/NioEndpoint.java @@ -368,8 +368,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) { @@ -385,8 +385,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())); } } @@ -956,8 +956,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 { @@ -970,15 +970,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); @@ -986,8 +986,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; @@ -996,8 +996,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); @@ -1008,7 +1008,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); @@ -1232,15 +1232,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(); @@ -1256,8 +1256,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()); @@ -1471,8 +1471,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); } @@ -1480,8 +1480,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); } @@ -1644,8 +1644,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 b41b05ac0e..4ec1b3c1c7 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 2de47812fa..24762506d7 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 5e1491bf24..bcecd87c6f 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 195f270f04..399c6a3985 100644 --- a/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java +++ b/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java @@ -107,8 +107,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 | @@ -216,8 +216,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); @@ -229,8 +229,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))); } } @@ -256,8 +256,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); @@ -269,8 +269,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))); } } @@ -401,8 +401,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)) { @@ -412,8 +412,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