This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new a3f70fa318 Review logging debug level: msg + exception
a3f70fa318 is described below
commit a3f70fa3188bf26bfd4e8c5c2c60073b44fc4827
Author: Mark Thomas <[email protected]>
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 ++-
.../org/apache/tomcat/util/compat/Jre24Compat.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 ++-
24 files changed, 116 insertions(+), 49 deletions(-)
diff --git a/java/org/apache/catalina/tribes/membership/McastServiceImpl.java
b/java/org/apache/catalina/tribes/membership/McastServiceImpl.java
index aed6d72999..5cd4e96a88 100644
--- a/java/org/apache/catalina/tribes/membership/McastServiceImpl.java
+++ b/java/org/apache/catalina/tribes/membership/McastServiceImpl.java
@@ -581,7 +581,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 b2cc887c5b..903a9d9112 100644
--- a/java/org/apache/catalina/valves/RemoteIpValve.java
+++ b/java/org/apache/catalina/valves/RemoteIpValve.java
@@ -628,7 +628,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 ab84ee0510..15ed866e6b 100644
--- a/java/org/apache/catalina/valves/StuckThreadDetectionValve.java
+++ b/java/org/apache/catalina/valves/StuckThreadDetectionValve.java
@@ -325,7 +325,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 3252a17f56..fb3b1a7dc2 100644
--- a/java/org/apache/coyote/AbstractProtocol.java
+++ b/java/org/apache/coyote/AbstractProtocol.java
@@ -1036,14 +1036,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 3898fe93d7..4a818f398b 100644
--- a/java/org/apache/coyote/ajp/AjpProcessor.java
+++ b/java/org/apache/coyote/ajp/AjpProcessor.java
@@ -385,7 +385,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);
@@ -398,7 +400,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 327b61d77d..df39ec2ecb 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 97566f51a4..5794516aa5 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 JreCompat {
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/compat/Jre24Compat.java
b/java/org/apache/tomcat/util/compat/Jre24Compat.java
index 07fcd5c93b..c9bb9b7d0f 100644
--- a/java/org/apache/tomcat/util/compat/Jre24Compat.java
+++ b/java/org/apache/tomcat/util/compat/Jre24Compat.java
@@ -37,7 +37,9 @@ public class Jre24Compat extends Jre22Compat {
m1 = Process.class.getMethod("waitFor", Duration.class);
} catch (NoSuchMethodException e) {
// Must be pre-Java 24
- log.debug(sm.getString("jre22Compat.javaPre24"), e);
+ if (log.isDebugEnabled()) {
+ log.debug(sm.getString("jre22Compat.javaPre24"), e);
+ }
}
supported = (m1 != null);
}
diff --git a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java
b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java
index 8976bf610d..877d5e41ca 100644
--- a/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java
+++ b/java/org/apache/tomcat/util/http/Rfc6265CookieProcessor.java
@@ -82,9 +82,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 cfdf998cde..41484905bf 100644
--- a/java/org/apache/tomcat/util/net/AbstractEndpoint.java
+++ b/java/org/apache/tomcat/util/net/AbstractEndpoint.java
@@ -1375,7 +1375,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 585a37d8af..d7eb5ea35b 100644
--- a/java/org/apache/tomcat/util/net/SecureNioChannel.java
+++ b/java/org/apache/tomcat/util/net/SecureNioChannel.java
@@ -578,7 +578,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 01b68798fc..9bcd968163 100644
--- a/java/org/apache/tomcat/util/net/jsse/JSSESupport.java
+++ b/java/org/apache/tomcat/util/net/jsse/JSSESupport.java
@@ -101,7 +101,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 2e4bb9a085..116d8a7f99 100644
--- a/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java
+++ b/java/org/apache/tomcat/util/net/openssl/OpenSSLContext.java
@@ -342,7 +342,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);
+ if (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 80da050da7..bb2f916567 100644
--- a/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java
+++ b/java/org/apache/tomcat/util/net/openssl/panama/OpenSSLContext.java
@@ -769,7 +769,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 a405d2c0a3..a3743989d9 100644
--- a/java/org/apache/tomcat/util/threads/TaskThread.java
+++ b/java/org/apache/tomcat/util/threads/TaskThread.java
@@ -58,9 +58,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 b9896e3ff4..48d6e565ff 100644
--- a/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
+++ b/java/org/apache/tomcat/websocket/WsWebSocketContainer.java
@@ -995,7 +995,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 8b5bf997be..66a6a6c3fe 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
@@ -437,7 +437,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
@@ -794,7 +796,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;
@@ -805,7 +807,7 @@ public class ConnectionPool {
}
} finally {
// con can never be null here
- if (error ) {
+ if (error) {
release(con);
}
con.unlock();
@@ -1108,7 +1110,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);
}
@@ -1156,7 +1160,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);
}
@@ -1215,7 +1221,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 337e08024d..43072ad370 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: [email protected]
For additional commands, e-mail: [email protected]