This is an automated email from the ASF dual-hosted git repository.
remm 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 56bbdd6ac9 Differentiate trace and debug log levels
56bbdd6ac9 is described below
commit 56bbdd6ac9c2ee690e33b2e6ceb97d4dbf0d7ad6
Author: remm <[email protected]>
AuthorDate: Fri Feb 2 13:51:40 2024 +0100
Differentiate trace and debug log levels
---
.../catalina/core/ApplicationDispatcher.java | 8 +--
.../org/apache/catalina/core/AsyncContextImpl.java | 28 +++++-----
.../apache/catalina/core/LocalStrings.properties | 3 +-
.../catalina/core/NamingContextListener.java | 4 +-
java/org/apache/catalina/core/StandardContext.java | 64 +++++++++++-----------
.../apache/catalina/core/StandardHostValve.java | 14 ++---
java/org/apache/catalina/core/StandardWrapper.java | 4 +-
7 files changed, 63 insertions(+), 62 deletions(-)
diff --git a/java/org/apache/catalina/core/ApplicationDispatcher.java
b/java/org/apache/catalina/core/ApplicationDispatcher.java
index ebc5111ecd..0707cf8eb3 100644
--- a/java/org/apache/catalina/core/ApplicationDispatcher.java
+++ b/java/org/apache/catalina/core/ApplicationDispatcher.java
@@ -291,8 +291,8 @@ final class ApplicationDispatcher implements
AsyncDispatcher, RequestDispatcher
}
// This is not a real close in order to support error processing
- if (wrapper.getLogger().isDebugEnabled()) {
- wrapper.getLogger().debug(" Disabling the response for further
output");
+ if (wrapper.getLogger().isTraceEnabled()) {
+ wrapper.getLogger().trace(" Disabling the response for further
output");
}
if (response instanceof ResponseFacade) {
@@ -300,9 +300,9 @@ final class ApplicationDispatcher implements
AsyncDispatcher, RequestDispatcher
} else {
// Servlet SRV.6.2.2. The Request/Response may have been wrapped
// and may no longer be instance of RequestFacade
- if (wrapper.getLogger().isDebugEnabled()) {
+ if (wrapper.getLogger().isTraceEnabled()) {
wrapper.getLogger()
- .debug(" The Response is vehiculed using a wrapper: "
+ response.getClass().getName());
+ .trace(" The Response is vehiculed using a wrapper: "
+ response.getClass().getName());
}
// Close anyway
diff --git a/java/org/apache/catalina/core/AsyncContextImpl.java
b/java/org/apache/catalina/core/AsyncContextImpl.java
index ae41532aca..832e9b61bc 100644
--- a/java/org/apache/catalina/core/AsyncContextImpl.java
+++ b/java/org/apache/catalina/core/AsyncContextImpl.java
@@ -77,7 +77,7 @@ public class AsyncContextImpl implements AsyncContext,
AsyncContextCallback {
private final AtomicBoolean hasOnErrorReturned = new AtomicBoolean(false);
public AsyncContextImpl(Request request) {
- if (log.isDebugEnabled()) {
+ if (log.isTraceEnabled()) {
logDebug("Constructor");
}
this.request = request;
@@ -85,7 +85,7 @@ public class AsyncContextImpl implements AsyncContext,
AsyncContextCallback {
@Override
public void complete() {
- if (log.isDebugEnabled()) {
+ if (log.isTraceEnabled()) {
logDebug("complete ");
}
check();
@@ -94,8 +94,8 @@ public class AsyncContextImpl implements AsyncContext,
AsyncContextCallback {
@Override
public void fireOnComplete() {
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("asyncContextImpl.fireOnComplete"));
+ if (log.isTraceEnabled()) {
+ log.trace(sm.getString("asyncContextImpl.fireOnComplete"));
}
List<AsyncListenerWrapper> listenersCopy = new ArrayList<>(listeners);
@@ -124,8 +124,8 @@ public class AsyncContextImpl implements AsyncContext,
AsyncContextCallback {
Context context = this.context;
if (result.get()) {
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("asyncContextImpl.fireOnTimeout"));
+ if (log.isTraceEnabled()) {
+ log.trace(sm.getString("asyncContextImpl.fireOnTimeout"));
}
ClassLoader oldCL = context.bind(null);
try {
@@ -178,7 +178,7 @@ public class AsyncContextImpl implements AsyncContext,
AsyncContextCallback {
@Override
public void dispatch(ServletContext servletContext, String path) {
synchronized (asyncContextLock) {
- if (log.isDebugEnabled()) {
+ if (log.isTraceEnabled()) {
logDebug("dispatch ");
}
check();
@@ -225,7 +225,7 @@ public class AsyncContextImpl implements AsyncContext,
AsyncContextCallback {
@Override
public void start(final Runnable run) {
- if (log.isDebugEnabled()) {
+ if (log.isTraceEnabled()) {
logDebug("start ");
}
check();
@@ -270,7 +270,7 @@ public class AsyncContextImpl implements AsyncContext,
AsyncContextCallback {
}
public void recycle() {
- if (log.isDebugEnabled()) {
+ if (log.isTraceEnabled()) {
logDebug("recycle ");
}
context = null;
@@ -311,8 +311,8 @@ public class AsyncContextImpl implements AsyncContext,
AsyncContextCallback {
List<AsyncListenerWrapper> listenersCopy = new
ArrayList<>(listeners);
listeners.clear();
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("asyncContextImpl.fireOnStartAsync"));
+ if (log.isTraceEnabled()) {
+ log.trace(sm.getString("asyncContextImpl.fireOnStartAsync"));
}
for (AsyncListenerWrapper listener : listenersCopy) {
try {
@@ -332,7 +332,7 @@ public class AsyncContextImpl implements AsyncContext,
AsyncContextCallback {
}
protected void doInternalDispatch() throws ServletException, IOException {
- if (log.isDebugEnabled()) {
+ if (log.isTraceEnabled()) {
logDebug("intDispatch");
}
try {
@@ -391,8 +391,8 @@ public class AsyncContextImpl implements AsyncContext,
AsyncContextCallback {
request.getCoyoteRequest().action(ActionCode.ASYNC_ERROR, null);
if (fireOnError) {
- if (log.isDebugEnabled()) {
- log.debug(sm.getString("asyncContextImpl.fireOnError"));
+ if (log.isTraceEnabled()) {
+ log.trace(sm.getString("asyncContextImpl.fireOnError"));
}
AsyncEvent errorEvent =
new AsyncEvent(event.getAsyncContext(),
event.getSuppliedRequest(), event.getSuppliedResponse(), t);
diff --git a/java/org/apache/catalina/core/LocalStrings.properties
b/java/org/apache/catalina/core/LocalStrings.properties
index e323b57b37..3a8ecc8c37 100644
--- a/java/org/apache/catalina/core/LocalStrings.properties
+++ b/java/org/apache/catalina/core/LocalStrings.properties
@@ -260,7 +260,8 @@ standardHost.nullName=Host name is required
standardHost.problematicAppBase=Using an empty string for appBase on host
[{0}] will set it to CATALINA_BASE, which is a bad idea
standardHost.problematicLegacyAppBase=Using an empty string for legacyAppBase
on host [{0}] will set it to CATALINA_BASE, which is a bad idea
-standardHostValue.customStatusFailed=Custom error page [{0}] could not be
dispatched correctly
+standardHostValve.customStatusFailed=Custom error page [{0}] could not be
dispatched correctly
+standardHostValve.exception=Exception Processing [{0}]
standardPipeline.basic.start=Error starting new basic Valve
standardPipeline.basic.stop=Error stopping old basic Valve
diff --git a/java/org/apache/catalina/core/NamingContextListener.java
b/java/org/apache/catalina/core/NamingContextListener.java
index 7013eb7d65..a81ff0a04c 100644
--- a/java/org/apache/catalina/core/NamingContextListener.java
+++ b/java/org/apache/catalina/core/NamingContextListener.java
@@ -496,8 +496,8 @@ public class NamingContextListener implements
LifecycleListener, PropertyChangeL
int i;
- if (log.isDebugEnabled()) {
- log.debug("Creating JNDI naming context");
+ if (log.isTraceEnabled()) {
+ log.trace("Creating JNDI naming context");
}
if (namingResources == null) {
diff --git a/java/org/apache/catalina/core/StandardContext.java
b/java/org/apache/catalina/core/StandardContext.java
index ccd026d78a..11417130b2 100644
--- a/java/org/apache/catalina/core/StandardContext.java
+++ b/java/org/apache/catalina/core/StandardContext.java
@@ -2117,8 +2117,8 @@ public class StandardContext extends ContainerBase
implements Context, Notificat
@Override
public void setPublicId(String publicId) {
- if (log.isDebugEnabled()) {
- log.debug("Setting deployment descriptor public ID to '" +
publicId + "'");
+ if (log.isTraceEnabled()) {
+ log.trace("Setting deployment descriptor public ID to '" +
publicId + "'");
}
String oldPublicId = this.publicId;
@@ -4242,8 +4242,8 @@ public class StandardContext extends ContainerBase
implements Context, Notificat
*/
public boolean filterStart() {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Starting filters");
+ if (getLogger().isTraceEnabled()) {
+ getLogger().trace("Starting filters");
}
// Instantiate and record a FilterConfig for each defined filter
boolean ok = true;
@@ -4251,8 +4251,8 @@ public class StandardContext extends ContainerBase
implements Context, Notificat
filterConfigs.clear();
for (Entry<String,FilterDef> entry : filterDefs.entrySet()) {
String name = entry.getKey();
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(" Starting filter '" + name + "'");
+ if (getLogger().isTraceEnabled()) {
+ getLogger().trace(" Starting filter '" + name + "'");
}
try {
ApplicationFilterConfig filterConfig = new
ApplicationFilterConfig(this, entry.getValue());
@@ -4277,15 +4277,15 @@ public class StandardContext extends ContainerBase
implements Context, Notificat
*/
public boolean filterStop() {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Stopping filters");
+ if (getLogger().isTraceEnabled()) {
+ getLogger().trace("Stopping filters");
}
// Release all Filter and FilterConfig instances
synchronized (filterDefs) {
for (Entry<String,ApplicationFilterConfig> entry :
filterConfigs.entrySet()) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(" Stopping filter '" + entry.getKey() +
"'");
+ if (getLogger().isTraceEnabled()) {
+ getLogger().trace(" Stopping filter '" + entry.getKey() +
"'");
}
ApplicationFilterConfig filterConfig = entry.getValue();
filterConfig.release();
@@ -4319,8 +4319,8 @@ public class StandardContext extends ContainerBase
implements Context, Notificat
*/
public boolean listenerStart() {
- if (log.isDebugEnabled()) {
- log.debug("Configuring application event listeners");
+ if (log.isTraceEnabled()) {
+ log.trace("Configuring application event listeners");
}
// Instantiate the required listeners
@@ -4328,8 +4328,8 @@ public class StandardContext extends ContainerBase
implements Context, Notificat
Object results[] = new Object[listeners.length];
boolean ok = true;
for (int i = 0; i < results.length; i++) {
- if (getLogger().isDebugEnabled()) {
- getLogger().debug(" Configuring event listener class '" +
listeners[i] + "'");
+ if (getLogger().isTraceEnabled()) {
+ getLogger().trace(" Configuring event listener class '" +
listeners[i] + "'");
}
try {
String listener = listeners[i];
@@ -4377,8 +4377,8 @@ public class StandardContext extends ContainerBase
implements Context, Notificat
// Send application start events
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("Sending application start events");
+ if (getLogger().isTraceEnabled()) {
+ getLogger().trace("Sending application start events");
}
// Ensure context is not null
@@ -4428,8 +4428,8 @@ public class StandardContext extends ContainerBase
implements Context, Notificat
*/
public boolean listenerStop() {
- if (log.isDebugEnabled()) {
- log.debug("Sending application stop events");
+ if (log.isTraceEnabled()) {
+ log.trace("Sending application stop events");
}
boolean ok = true;
@@ -4615,8 +4615,8 @@ public class StandardContext extends ContainerBase
implements Context, Notificat
@Override
protected void startInternal() throws LifecycleException {
- if (log.isDebugEnabled()) {
- log.debug("Starting " + getBaseName());
+ if (log.isTraceEnabled()) {
+ log.trace("Starting " + getBaseName());
}
// Send j2ee.state.starting notification
@@ -4640,8 +4640,8 @@ public class StandardContext extends ContainerBase
implements Context, Notificat
// Add missing components as necessary
if (getResources() == null) { // (1) Required by Loader
- if (log.isDebugEnabled()) {
- log.debug("Configuring default Resources");
+ if (log.isTraceEnabled()) {
+ log.trace("Configuring default Resources");
}
try {
@@ -4686,8 +4686,8 @@ public class StandardContext extends ContainerBase
implements Context, Notificat
}
// Standard container startup
- if (log.isDebugEnabled()) {
- log.debug("Processing standard container startup");
+ if (log.isTraceEnabled()) {
+ log.trace("Processing standard container startup");
}
@@ -4890,8 +4890,8 @@ public class StandardContext extends ContainerBase
implements Context, Notificat
// Set available status depending upon startup success
if (ok) {
- if (log.isDebugEnabled()) {
- log.debug("Starting completed");
+ if (log.isTraceEnabled()) {
+ log.trace("Starting completed");
}
} else {
log.error(sm.getString("standardContext.startFailed", getName()));
@@ -5080,8 +5080,8 @@ public class StandardContext extends ContainerBase
implements Context, Notificat
setCharsetMapper(null);
// Normal container shutdown processing
- if (log.isDebugEnabled()) {
- log.debug("Processing standard container shutdown");
+ if (log.isTraceEnabled()) {
+ log.trace("Processing standard container shutdown");
}
// JNDI resources are unbound in CONFIGURE_STOP_EVENT so stop
@@ -5147,8 +5147,8 @@ public class StandardContext extends ContainerBase
implements Context, Notificat
// reset the instance manager
setInstanceManager(null);
- if (log.isDebugEnabled()) {
- log.debug("Stopping complete");
+ if (log.isTraceEnabled()) {
+ log.trace("Stopping complete");
}
}
@@ -5265,8 +5265,8 @@ public class StandardContext extends ContainerBase
implements Context, Notificat
postConstructMethods.clear();
preDestroyMethods.clear();
- if (log.isDebugEnabled()) {
- log.debug("resetContext " + getObjectName());
+ if (log.isTraceEnabled()) {
+ log.trace("resetContext " + getObjectName());
}
}
diff --git a/java/org/apache/catalina/core/StandardHostValve.java
b/java/org/apache/catalina/core/StandardHostValve.java
index b4be2e6b6f..a67ec0d2bf 100644
--- a/java/org/apache/catalina/core/StandardHostValve.java
+++ b/java/org/apache/catalina/core/StandardHostValve.java
@@ -116,7 +116,7 @@ final class StandardHostValve extends ValveBase {
}
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- container.getLogger().error("Exception Processing " +
request.getRequestURI(), t);
+
container.getLogger().error(sm.getString("standardHostValve.exception",
request.getRequestURI()), t);
// If a new error occurred while trying to report a previous
// error allow the original error to be reported.
if (!response.isErrorReportRequired()) {
@@ -228,7 +228,7 @@ final class StandardHostValve extends ValveBase {
} catch (ClientAbortException e) {
// Ignore
} catch (IOException e) {
- container.getLogger().warn("Exception Processing " +
errorPage, e);
+
container.getLogger().warn(sm.getString("standardHostValve.exception",
errorPage), e);
}
}
}
@@ -292,7 +292,7 @@ final class StandardHostValve extends ValveBase {
try {
response.finishResponse();
} catch (IOException e) {
- container.getLogger().warn("Exception Processing " +
errorPage, e);
+
container.getLogger().warn(sm.getString("standardHostValve.exception",
errorPage), e);
}
}
}
@@ -325,8 +325,8 @@ final class StandardHostValve extends ValveBase {
*/
private boolean custom(Request request, Response response, ErrorPage
errorPage) {
- if (container.getLogger().isDebugEnabled()) {
- container.getLogger().debug("Processing " + errorPage);
+ if (container.getLogger().isTraceEnabled()) {
+ container.getLogger().trace("Processing " + errorPage);
}
try {
@@ -336,7 +336,7 @@ final class StandardHostValve extends ValveBase {
if (rd == null) {
container.getLogger()
-
.error(sm.getString("standardHostValue.customStatusFailed",
errorPage.getLocation()));
+
.error(sm.getString("standardHostValve.customStatusFailed",
errorPage.getLocation()));
return false;
}
@@ -374,7 +374,7 @@ final class StandardHostValve extends ValveBase {
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
// Report our failure to process this custom page
- container.getLogger().error("Exception Processing " + errorPage,
t);
+
container.getLogger().error(sm.getString("standardHostValve.exception",
errorPage), t);
return false;
}
}
diff --git a/java/org/apache/catalina/core/StandardWrapper.java
b/java/org/apache/catalina/core/StandardWrapper.java
index d6b997620e..6f8b3919ce 100644
--- a/java/org/apache/catalina/core/StandardWrapper.java
+++ b/java/org/apache/catalina/core/StandardWrapper.java
@@ -636,8 +636,8 @@ public class StandardWrapper extends ContainerBase
implements ServletConfig, Wra
synchronized (this) {
if (instance == null) {
try {
- if (log.isDebugEnabled()) {
- log.debug("Allocating instance");
+ if (log.isTraceEnabled()) {
+ log.trace("Allocating instance");
}
instance = loadServlet();
newInstance = true;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]