Skip to content

Commit d99061b

Browse files
committed
SWS-296
1 parent 4dbdee3 commit d99061b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

core/src/main/java/org/springframework/ws/server/endpoint/AbstractLoggingInterceptor.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
import javax.xml.transform.TransformerException;
2525
import javax.xml.transform.stream.StreamResult;
2626

27+
import org.apache.commons.logging.Log;
28+
import org.apache.commons.logging.LogFactory;
29+
2730
import org.springframework.ws.WebServiceMessage;
2831
import org.springframework.ws.context.MessageContext;
2932
import org.springframework.ws.server.EndpointInterceptor;
@@ -39,6 +42,12 @@
3942
*/
4043
public abstract class AbstractLoggingInterceptor extends TransformerObjectSupport implements EndpointInterceptor {
4144

45+
/**
46+
* The default <code>Log</code> instance used to write trace messages. This instance is mapped to the implementing
47+
* <code>Class</code>.
48+
*/
49+
protected transient Log logger = LogFactory.getLog(getClass());
50+
4251
private boolean logRequest = true;
4352

4453
private boolean logResponse = true;
@@ -53,6 +62,20 @@ public final void setLogResponse(boolean logResponse) {
5362
this.logResponse = logResponse;
5463
}
5564

65+
/**
66+
* Set the name of the logger to use. The name will be passed to the underlying logger implementation through
67+
* Commons Logging, getting interpreted as log category according to the logger's configuration.
68+
* <p/>
69+
* This can be specified to not log into the category of a class but rather into a specific named category.
70+
*
71+
* @see org.apache.commons.logging.LogFactory#getLog(String)
72+
* @see org.apache.log4j.Logger#getLogger(String)
73+
* @see java.util.logging.Logger#getLogger(String)
74+
*/
75+
public void setLoggerName(String loggerName) {
76+
this.logger = LogFactory.getLog(loggerName);
77+
}
78+
5679
/**
5780
* Logs the request message payload. Logging only ocurs if <code>logRequest</code> is set to <code>true</code>,
5881
* which is the default.

0 commit comments

Comments
 (0)