This commit is contained in:
Arjen Poutsma
2008-02-26 00:49:26 +00:00
parent 4dbdee3e70
commit d99061b64d

View File

@@ -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 <code>Log</code> instance used to write trace messages. This instance is mapped to the implementing
* <code>Class</code>.
*/
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.
* <p/>
* 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 <code>logRequest</code> is set to <code>true</code>,
* which is the default.