diff --git a/core/src/main/java/org/springframework/ws/server/endpoint/AbstractLoggingInterceptor.java b/core/src/main/java/org/springframework/ws/server/endpoint/AbstractLoggingInterceptor.java index e60f3949..f032afea 100644 --- a/core/src/main/java/org/springframework/ws/server/endpoint/AbstractLoggingInterceptor.java +++ b/core/src/main/java/org/springframework/ws/server/endpoint/AbstractLoggingInterceptor.java @@ -24,6 +24,9 @@ import javax.xml.transform.TransformerConfigurationException; import javax.xml.transform.TransformerException; import javax.xml.transform.stream.StreamResult; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import org.springframework.ws.WebServiceMessage; import org.springframework.ws.context.MessageContext; import org.springframework.ws.server.EndpointInterceptor; @@ -39,6 +42,12 @@ import org.springframework.xml.transform.TransformerObjectSupport; */ public abstract class AbstractLoggingInterceptor extends TransformerObjectSupport implements EndpointInterceptor { + /** + * The default Log instance used to write trace messages. This instance is mapped to the implementing + * Class. + */ + protected transient Log logger = LogFactory.getLog(getClass()); + private boolean logRequest = true; private boolean logResponse = true; @@ -53,6 +62,20 @@ public abstract class AbstractLoggingInterceptor extends TransformerObjectSuppor this.logResponse = logResponse; } + /** + * Set the name of the logger to use. The name will be passed to the underlying logger implementation through + * Commons Logging, getting interpreted as log category according to the logger's configuration. + *

+ * This can be specified to not log into the category of a class but rather into a specific named category. + * + * @see org.apache.commons.logging.LogFactory#getLog(String) + * @see org.apache.log4j.Logger#getLogger(String) + * @see java.util.logging.Logger#getLogger(String) + */ + public void setLoggerName(String loggerName) { + this.logger = LogFactory.getLog(loggerName); + } + /** * Logs the request message payload. Logging only ocurs if logRequest is set to true, * which is the default.