This is an automated email from the ASF dual-hosted git repository. markt 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 8d1c9f9fcb Review logging debug level: msg + exception 8d1c9f9fcb is described below commit 8d1c9f9fcb64d76ecc3d8fdc46fa7a250a12eeb3 Author: Mark Thomas <ma...@apache.org> AuthorDate: Wed Aug 20 16:20:54 2025 +0100 Review logging debug level: msg + exception --- .../tribes/membership/McastServiceImpl.java | 2 +- .../catalina/tribes/transport/nio/NioReceiver.java | 4 +-- java/org/apache/catalina/valves/RemoteIpValve.java | 4 ++- .../catalina/valves/StuckThreadDetectionValve.java | 4 ++- java/org/apache/coyote/AbstractProtocol.java | 15 ++++++--- java/org/apache/coyote/ajp/AjpProcessor.java | 8 +++-- .../optimizations/ELInterpreterTagSetters.java | 38 ++++++++++++++++------ .../optimizations/StringInterpreterEnum.java | 4 ++- .../tomcat/dbcp/dbcp2/ObjectNameWrapper.java | 4 ++- .../org/apache/tomcat/util/compat/Jre22Compat.java | 4 ++- .../tomcat/util/http/Rfc6265CookieProcessor.java | 3 +- .../apache/tomcat/util/net/AbstractEndpoint.java | 4 ++- .../apache/tomcat/util/net/SecureNioChannel.java | 4 ++- .../apache/tomcat/util/net/jsse/JSSESupport.java | 4 ++- .../tomcat/util/net/openssl/OpenSSLContext.java | 4 ++- .../util/net/openssl/panama/OpenSSLContext.java | 4 ++- .../org/apache/tomcat/util/threads/TaskThread.java | 7 ++-- .../tomcat/websocket/WsWebSocketContainer.java | 4 ++- .../apache/tomcat/jdbc/pool/ConnectionPool.java | 20 ++++++++---- .../apache/tomcat/jdbc/pool/DataSourceFactory.java | 4 ++- .../apache/tomcat/jdbc/pool/PoolProperties.java | 6 ++-- .../apache/tomcat/jdbc/pool/PooledConnection.java | 6 ++-- .../classes/websocket/chat/ChatAnnotation.java | 4 ++- 23 files changed, 113 insertions(+), 48 deletions(-) diff --git a/java/org/apache/catalina/tribes/membership/McastServiceImpl.java b/java/org/apache/catalina/tribes/membership/McastServiceImpl.java index 447d1fe1e9..aca12e95c4 100644 --- a/java/org/apache/catalina/tribes/membership/McastServiceImpl.java +++ b/java/org/apache/catalina/tribes/membership/McastServiceImpl.java @@ -583,7 +583,7 @@ public class McastServiceImpl extends MembershipProviderBase { if (doRunReceiver) { log.debug(sm.getString("mcastServiceImpl.error.receiving"), e); } else { - log.warn(sm.getString("mcastServiceImpl.error.receivingNoSleep"), e); + log.debug(sm.getString("mcastServiceImpl.error.receivingNoSleep"), e); } } if (doRunReceiver) { diff --git a/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java b/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java index 3a0d970fad..9750b1a558 100644 --- a/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java +++ b/java/org/apache/catalina/tribes/transport/nio/NioReceiver.java @@ -344,9 +344,9 @@ public class NioReceiver extends ReceiverBase implements Runnable, NioReceiverMB if (datagramChannel != null) { try { datagramChannel.close(); - } catch (Exception iox) { + } catch (Exception e) { if (log.isDebugEnabled()) { - log.debug(sm.getString("nioReceiver.closeError"), iox); + log.debug(sm.getString("nioReceiver.closeError"), e); } } datagramChannel = null; diff --git a/java/org/apache/catalina/valves/RemoteIpValve.java b/java/org/apache/catalina/valves/RemoteIpValve.java index b1123ae9f1..d840866f2a 100644 --- a/java/org/apache/catalina/valves/RemoteIpValve.java +++ b/java/org/apache/catalina/valves/RemoteIpValve.java @@ -672,7 +672,9 @@ public class RemoteIpValve extends ValveBase { // We know we need a DNS look up so use getCanonicalHostName() request.setRemoteHost(inetAddress.getCanonicalHostName()); } catch (UnknownHostException e) { - log.debug(sm.getString("remoteIpValve.invalidRemoteAddress", remoteIp), e); + if (log.isDebugEnabled()) { + log.debug(sm.getString("remoteIpValve.invalidRemoteAddress", remoteIp), e); + } request.setRemoteHost(remoteIp); } } else { diff --git a/java/org/apache/catalina/valves/StuckThreadDetectionValve.java b/java/org/apache/catalina/valves/StuckThreadDetectionValve.java index 4ecfd230b1..29115bff04 100644 --- a/java/org/apache/catalina/valves/StuckThreadDetectionValve.java +++ b/java/org/apache/catalina/valves/StuckThreadDetectionValve.java @@ -322,7 +322,9 @@ public class StuckThreadDetectionValve extends ValveBase { // going out from here, maybe already serving a new request this.interruptionSemaphore.acquire(); } catch (InterruptedException e) { - log.debug(sm.getString("stuckThreadDetectionValve.interrupted"), e); + if (log.isDebugEnabled()) { + log.debug(sm.getString("stuckThreadDetectionValve.interrupted"), e); + } } // no need to release the semaphore, it will be GCed } diff --git a/java/org/apache/coyote/AbstractProtocol.java b/java/org/apache/coyote/AbstractProtocol.java index ac96ad912d..79a8e90057 100644 --- a/java/org/apache/coyote/AbstractProtocol.java +++ b/java/org/apache/coyote/AbstractProtocol.java @@ -1068,14 +1068,19 @@ public abstract class AbstractProtocol<S> implements ProtocolHandler, MBeanRegis return state; } catch (SocketException e) { // SocketExceptions are normal - getLog().debug(sm.getString("abstractConnectionHandler.socketexception.debug"), e); + if (getLog().isDebugEnabled()) { + getLog().debug(sm.getString("abstractConnectionHandler.socketexception.debug"), e); + } } catch (IOException ioe) { // IOExceptions are normal - getLog().debug(sm.getString("abstractConnectionHandler.ioexception.debug"), ioe); + if (getLog().isDebugEnabled()) { + getLog().debug(sm.getString("abstractConnectionHandler.ioexception.debug"), ioe); + } } catch (ProtocolException e) { - // Protocol exceptions normally mean the client sent invalid or - // incomplete data. - getLog().debug(sm.getString("abstractConnectionHandler.protocolexception.debug"), e); + // Protocol exceptions normally mean the client sent invalid or incomplete data. + if (getLog().isDebugEnabled()) { + getLog().debug(sm.getString("abstractConnectionHandler.protocolexception.debug"), e); + } } // Future developers: if you discover any other // rare-but-nonfatal exceptions, catch them here, and log as diff --git a/java/org/apache/coyote/ajp/AjpProcessor.java b/java/org/apache/coyote/ajp/AjpProcessor.java index 048cbf7c35..6dda7f3f1b 100644 --- a/java/org/apache/coyote/ajp/AjpProcessor.java +++ b/java/org/apache/coyote/ajp/AjpProcessor.java @@ -390,7 +390,9 @@ public class AjpProcessor extends AbstractProcessor { break; } catch (Throwable t) { ExceptionUtils.handleThrowable(t); - getLog().debug(sm.getString("ajpprocessor.header.error"), t); + if (getLog().isDebugEnabled()) { + getLog().debug(sm.getString("ajpprocessor.header.error"), t); + } // 400 - Bad Request response.setStatus(400); setErrorState(ErrorState.CLOSE_CLEAN, t); @@ -403,7 +405,9 @@ public class AjpProcessor extends AbstractProcessor { prepareRequest(); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); - getLog().debug(sm.getString("ajpprocessor.request.prepare"), t); + if (getLog().isDebugEnabled()) { + getLog().debug(sm.getString("ajpprocessor.request.prepare"), t); + } // 500 - Internal Server Error response.setStatus(500); setErrorState(ErrorState.CLOSE_CLEAN, t); diff --git a/java/org/apache/jasper/optimizations/ELInterpreterTagSetters.java b/java/org/apache/jasper/optimizations/ELInterpreterTagSetters.java index 36f320e731..6c5121fb02 100644 --- a/java/org/apache/jasper/optimizations/ELInterpreterTagSetters.java +++ b/java/org/apache/jasper/optimizations/ELInterpreterTagSetters.java @@ -110,7 +110,9 @@ public class ELInterpreterTagSetters implements ELInterpreter { BigDecimal unused = new BigDecimal(m.group(2)); result = "new java.math.BigDecimal(\"" + m.group(2) + "\")"; } catch (NumberFormatException e) { - log.debug(Localizer.getMessage("jsp.error.typeConversion", m.group(2), "BigDecimal"), e); + if (log.isDebugEnabled()) { + log.debug(Localizer.getMessage("jsp.error.typeConversion", m.group(2), "BigDecimal"), e); + } // Continue and resolve the value at runtime } } @@ -128,7 +130,9 @@ public class ELInterpreterTagSetters implements ELInterpreter { result = "Long.valueOf(\"" + m.group(2) + "\")"; } } catch (NumberFormatException e) { - log.debug(Localizer.getMessage("jsp.error.typeConversion", m.group(2), "Long"), e); + if (log.isDebugEnabled()) { + log.debug(Localizer.getMessage("jsp.error.typeConversion", m.group(2), "Long"), e); + } // Continue and resolve the value at runtime } } @@ -145,7 +149,9 @@ public class ELInterpreterTagSetters implements ELInterpreter { result = "Integer.valueOf(\"" + m.group(2) + "\")"; } } catch (NumberFormatException e) { - log.debug(Localizer.getMessage("jsp.error.typeConversion", m.group(2), "Integer"), e); + if (log.isDebugEnabled()) { + log.debug(Localizer.getMessage("jsp.error.typeConversion", m.group(2), "Integer"), e); + } // Continue and resolve the value at runtime } } @@ -163,7 +169,9 @@ public class ELInterpreterTagSetters implements ELInterpreter { result = "Short.valueOf(\"" + m.group(2) + "\")"; } } catch (NumberFormatException e) { - log.debug(Localizer.getMessage("jsp.error.typeConversion", m.group(2), "Short"), e); + if (log.isDebugEnabled()) { + log.debug(Localizer.getMessage("jsp.error.typeConversion", m.group(2), "Short"), e); + } // Continue and resolve the value at runtime } } @@ -181,7 +189,9 @@ public class ELInterpreterTagSetters implements ELInterpreter { result = "Byte.valueOf(\"" + m.group(2) + "\")"; } } catch (NumberFormatException e) { - log.debug(Localizer.getMessage("jsp.error.typeConversion", m.group(2), "Byte"), e); + if (log.isDebugEnabled()) { + log.debug(Localizer.getMessage("jsp.error.typeConversion", m.group(2), "Byte"), e); + } // Continue and resolve the value at runtime } } @@ -198,7 +208,9 @@ public class ELInterpreterTagSetters implements ELInterpreter { result = "Double.valueOf(\"" + m.group(2) + "\")"; } } catch (NumberFormatException e) { - log.debug(Localizer.getMessage("jsp.error.typeConversion", m.group(2), "Double"), e); + if (log.isDebugEnabled()) { + log.debug(Localizer.getMessage("jsp.error.typeConversion", m.group(2), "Double"), e); + } // Continue and resolve the value at runtime } } @@ -216,7 +228,9 @@ public class ELInterpreterTagSetters implements ELInterpreter { result = "Float.valueOf(\"" + m.group(2) + "\")"; } } catch (NumberFormatException e) { - log.debug(Localizer.getMessage("jsp.error.typeConversion", m.group(2), "Float"), e); + if (log.isDebugEnabled()) { + log.debug(Localizer.getMessage("jsp.error.typeConversion", m.group(2), "Float"), e); + } // Continue and resolve the value at runtime } } @@ -229,7 +243,9 @@ public class ELInterpreterTagSetters implements ELInterpreter { BigInteger unused = new BigInteger(m.group(2)); result = "new java.math.BigInteger(\"" + m.group(2) + "\")"; } catch (NumberFormatException e) { - log.debug(Localizer.getMessage("jsp.error.typeConversion", m.group(2), "BigInteger"), e); + if (log.isDebugEnabled()) { + log.debug(Localizer.getMessage("jsp.error.typeConversion", m.group(2), "BigInteger"), e); + } // Continue and resolve the value at runtime } } @@ -242,8 +258,10 @@ public class ELInterpreterTagSetters implements ELInterpreter { Enum<?> enumValue = Enum.valueOf((Class<? extends Enum>) expectedType, m.group(2)); result = expectedType.getName() + "." + enumValue.name(); } catch (IllegalArgumentException iae) { - log.debug(Localizer.getMessage("jsp.error.typeConversion", m.group(2), - "Enum[" + expectedType.getName() + "]"), iae); + if (log.isDebugEnabled()) { + log.debug(Localizer.getMessage("jsp.error.typeConversion", m.group(2), + "Enum[" + expectedType.getName() + "]"), iae); + } // Continue and resolve the value at runtime } } diff --git a/java/org/apache/jasper/optimizations/StringInterpreterEnum.java b/java/org/apache/jasper/optimizations/StringInterpreterEnum.java index 9312117730..b057cd499e 100644 --- a/java/org/apache/jasper/optimizations/StringInterpreterEnum.java +++ b/java/org/apache/jasper/optimizations/StringInterpreterEnum.java @@ -37,7 +37,9 @@ public class StringInterpreterEnum extends DefaultStringInterpreter { Enum<?> enumValue = Enum.valueOf((Class<? extends Enum>) c, s); return c.getName() + "." + enumValue.name(); } catch (IllegalArgumentException iae) { - log.debug(Localizer.getMessage("jsp.error.typeConversion", s, "Enum[" + c.getName() + "]"), iae); + if (log.isDebugEnabled()) { + log.debug(Localizer.getMessage("jsp.error.typeConversion", s, "Enum[" + c.getName() + "]"), iae); + } // Continue and resolve the value at runtime } } diff --git a/java/org/apache/tomcat/dbcp/dbcp2/ObjectNameWrapper.java b/java/org/apache/tomcat/dbcp/dbcp2/ObjectNameWrapper.java index 5f81329bb3..e35d3f79d0 100644 --- a/java/org/apache/tomcat/dbcp/dbcp2/ObjectNameWrapper.java +++ b/java/org/apache/tomcat/dbcp/dbcp2/ObjectNameWrapper.java @@ -42,7 +42,9 @@ final class ObjectNameWrapper { return ManagementFactory.getPlatformMBeanServer(); } catch (final LinkageError | Exception e) { // ignore - JMX not available - log.debug("Failed to get platform MBeanServer", e); + if (log.isDebugEnabled()) { + log.debug("Failed to get platform MBeanServer", e); + } return null; } } diff --git a/java/org/apache/tomcat/util/compat/Jre22Compat.java b/java/org/apache/tomcat/util/compat/Jre22Compat.java index fd45c20bd6..d06ec739af 100644 --- a/java/org/apache/tomcat/util/compat/Jre22Compat.java +++ b/java/org/apache/tomcat/util/compat/Jre22Compat.java @@ -37,7 +37,9 @@ public class Jre22Compat extends Jre21Compat { c1 = Class.forName("java.text.ListFormat"); } catch (ClassNotFoundException e) { // Must be pre-Java 22 - log.debug(sm.getString("jre22Compat.javaPre22"), e); + if (log.isDebugEnabled()) { + log.debug(sm.getString("jre22Compat.javaPre22"), e); + } } supported = (c1 != null); } diff --git a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java index c80d7878d9..946a5fa365 100644 --- a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java +++ b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java @@ -77,9 +77,8 @@ public class Rfc6265CookieProcessor extends CookieProcessorBase { if (cookieValue != null && !cookieValue.isNull()) { if (cookieValue.getType() != MessageBytes.T_BYTES) { if (log.isDebugEnabled()) { - Exception e = new Exception(); // TODO: Review this in light of HTTP/2 - log.debug(sm.getString("rfc6265CookieProcessor.expectedBytes"), e); + log.debug(sm.getString("rfc6265CookieProcessor.expectedBytes"), new Exception()); } cookieValue.toBytes(); } diff --git a/java/org/apache/tomcat/util/net/AbstractEndpoint.java b/java/org/apache/tomcat/util/net/AbstractEndpoint.java index d4cdb242d4..6696a30ea3 100644 --- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java +++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java @@ -1284,7 +1284,9 @@ public abstract class AbstractEndpoint<S, U> { try { localAddress = getLocalAddress(); } catch (IOException ioe) { - getLog().debug(sm.getString("endpoint.debug.unlock.localFail", getName()), ioe); + if (getLog().isDebugEnabled()) { + getLog().debug(sm.getString("endpoint.debug.unlock.localFail", getName()), ioe); + } } if (localAddress == null) { getLog().warn(sm.getString("endpoint.debug.unlock.localNone", getName())); diff --git a/java/org/apache/tomcat/util/net/SecureNioChannel.java b/java/org/apache/tomcat/util/net/SecureNioChannel.java index e0ff4110b6..db438e7b3c 100644 --- a/java/org/apache/tomcat/util/net/SecureNioChannel.java +++ b/java/org/apache/tomcat/util/net/SecureNioChannel.java @@ -580,7 +580,9 @@ public class SecureNioChannel extends NioChannel { } catch (IOException ioe) { // This is expected - swallowing the exception is the reason this // method exists. Log at debug in case someone is interested. - log.debug(sm.getString("channel.nio.ssl.closeSilentError"), ioe); + if (log.isDebugEnabled()) { + log.debug(sm.getString("channel.nio.ssl.closeSilentError"), ioe); + } } } diff --git a/java/org/apache/tomcat/util/net/jsse/JSSESupport.java b/java/org/apache/tomcat/util/net/jsse/JSSESupport.java index 6dbcf6fe26..583d610c39 100644 --- a/java/org/apache/tomcat/util/net/jsse/JSSESupport.java +++ b/java/org/apache/tomcat/util/net/jsse/JSSESupport.java @@ -111,7 +111,9 @@ public class JSSESupport implements SSLSupport, SSLSessionManager { try { certs = session.getPeerCertificates(); } catch (Throwable t) { - log.debug(sm.getString("jsseSupport.clientCertError"), t); + if (log.isDebugEnabled()) { + log.debug(sm.getString("jsseSupport.clientCertError"), t); + } return null; } diff --git a/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java b/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java index f1dd1e629e..8194e2f113 100644 --- a/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java +++ b/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java @@ -368,7 +368,9 @@ public class OpenSSLContext implements org.apache.tomcat.util.net.SSLContext { x509TrustManager.checkClientTrusted(peerCerts, auth); return true; } catch (Exception e) { - log.debug(sm.getString("openssl.certificateVerificationFailed"), e); + log.isDebugEnabled() { + log.debug(sm.getString("openssl.certificateVerificationFailed"), e); + } } return false; } diff --git a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java index c302cc7e08..8e9cc2e33c 100644 --- a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java +++ b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java @@ -768,7 +768,9 @@ public class OpenSSLContext implements org.apache.tomcat.util.net.SSLContext { x509TrustManager.checkClientTrusted(peerCerts, authMethod); return 1; } catch (Exception e) { - log.debug(sm.getString("openssl.certificateVerificationFailed"), e); + if (log.isDebugEnabled()) { + log.debug(sm.getString("openssl.certificateVerificationFailed"), e); + } } } return 0; diff --git a/java/org/apache/tomcat/util/threads/TaskThread.java b/java/org/apache/tomcat/util/threads/TaskThread.java index 33a7be1a69..fec5da028d 100644 --- a/java/org/apache/tomcat/util/threads/TaskThread.java +++ b/java/org/apache/tomcat/util/threads/TaskThread.java @@ -62,9 +62,10 @@ public class TaskThread extends Thread { try { wrappedRunnable.run(); } catch(StopPooledThreadException exc) { - //expected : we just swallow the exception to avoid disturbing - //debuggers like eclipse's - log.debug(sm.getString("taskThread.exiting"), exc); + // expected : we just swallow the exception to avoid disturbing debuggers like eclipse's + if (log.isDebugEnabled()) { + log.debug(sm.getString("taskThread.exiting"), exc); + } } } } diff --git a/java/org/apache/tomcat/websocket/WsWebSocketContainer.java b/java/org/apache/tomcat/websocket/WsWebSocketContainer.java index bd989a6f0e..9a4177b5f4 100644 --- a/java/org/apache/tomcat/websocket/WsWebSocketContainer.java +++ b/java/org/apache/tomcat/websocket/WsWebSocketContainer.java @@ -1013,7 +1013,9 @@ public class WsWebSocketContainer implements WebSocketContainer, BackgroundProce try { session.close(cr); } catch (IOException ioe) { - log.debug(sm.getString("wsWebSocketContainer.sessionCloseFail", session.getId()), ioe); + if (log.isDebugEnabled()) { + log.debug(sm.getString("wsWebSocketContainer.sessionCloseFail", session.getId()), ioe); + } } } diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java index e8acaef630..47202c4780 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java @@ -432,7 +432,9 @@ public class ConnectionPool { interceptor.setProperties(proxies[i].getProperties()); interceptor.poolClosed(this); }catch (Exception x) { - log.debug("Unable to inform interceptor of pool closure.",x); + if (log.isDebugEnabled()) { + log.debug("Unable to inform interceptor of pool closure.",x); + } } } } //closePool @@ -789,7 +791,7 @@ public class ConnectionPool { } catch (Exception e) { error = true; if (log.isDebugEnabled()) { - log.debug("Unable to create a new JDBC connection.", e); + log.debug("Unable to create a new JDBC connection.", e); } if (e instanceof SQLException) { throw (SQLException)e; @@ -800,7 +802,7 @@ public class ConnectionPool { } } finally { // con can never be null here - if (error ) { + if (error) { release(con); } con.unlock(); @@ -1103,7 +1105,9 @@ public class ConnectionPool { } } //while } catch (ConcurrentModificationException e) { - log.debug("checkAbandoned failed." ,e); + if (log.isDebugEnabled()) { + log.debug("checkAbandoned failed." ,e); + } } catch (Exception e) { log.warn("checkAbandoned failed, it will be retried.",e); } @@ -1151,7 +1155,9 @@ public class ConnectionPool { } } //while } catch (ConcurrentModificationException e) { - log.debug("checkIdle failed." ,e); + if (log.isDebugEnabled()) { + log.debug("checkIdle failed." ,e); + } } catch (Exception e) { log.warn("checkIdle failed, it will be retried.",e); } @@ -1210,7 +1216,9 @@ public class ConnectionPool { } } //while } catch (ConcurrentModificationException e) { - log.debug("testAllIdle failed." ,e); + if (log.isDebugEnabled()) { + log.debug("testAllIdle failed." ,e); + } } catch (Exception e) { log.warn("testAllIdle failed, it will be retried.",e); } diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java index 1d777a69e6..16b96182a9 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceFactory.java @@ -571,7 +571,9 @@ public class DataSourceFactory implements ObjectFactory { log.warn("dataSourceJNDI property is configured, but local JNDI context is null."); } } catch (NamingException e) { - log.debug("The name \""+poolProperties.getDataSourceJNDI()+"\" cannot be found in the local context.", e); + if (log.isDebugEnabled()) { + log.debug("The name \""+poolProperties.getDataSourceJNDI()+"\" cannot be found in the local context.", e); + } } if (jndiDS==null) { try { diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java index 1157a0ed7e..d8e3fb7e13 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java @@ -627,9 +627,11 @@ public class PoolProperties implements PoolConfiguration, Cloneable, Serializabl } } buf.append(']'); - }catch (Exception x) { + } catch (Exception x) { //shouldn't happen - log.debug("toString() call failed", x); + if (log.isDebugEnabled()) { + log.debug("toString() call failed", x); + } } return buf.toString(); } diff --git a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java index 0326e0c65a..0407a0d144 100644 --- a/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java +++ b/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java @@ -214,7 +214,9 @@ public class PooledConnection implements PooledConnectionMBean { try { this.disconnect(false); } catch (Exception x) { - log.debug("Unable to disconnect previous connection.", x); + if (log.isDebugEnabled()) { + log.debug("Unable to disconnect previous connection.", x); + } } //catch } //end if //if (poolProperties.getDataSource()==null && poolProperties.getDataSourceJNDI()!=null) { @@ -415,7 +417,7 @@ public class PooledConnection implements PooledConnectionMBean { } else { xaConnection.close(); } - }catch (Exception ignore) { + } catch (Exception ignore) { if (log.isDebugEnabled()) { log.debug("Unable to close underlying SQL connection",ignore); } diff --git a/webapps/examples/WEB-INF/classes/websocket/chat/ChatAnnotation.java b/webapps/examples/WEB-INF/classes/websocket/chat/ChatAnnotation.java index dee5c4e5ab..5aa592881b 100644 --- a/webapps/examples/WEB-INF/classes/websocket/chat/ChatAnnotation.java +++ b/webapps/examples/WEB-INF/classes/websocket/chat/ChatAnnotation.java @@ -126,7 +126,9 @@ public class ChatAnnotation { try { client.sendMessage(msg); } catch (IOException e) { - log.debug("Chat Error: Failed to send message to client", e); + if (log.isDebugEnabled()) { + log.debug("Chat Error: Failed to send message to client", e); + } if (connections.remove(client)) { try { client.session.close(); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org