24
24
import javax .xml .transform .TransformerException ;
25
25
import javax .xml .transform .stream .StreamResult ;
26
26
27
+ import org .apache .commons .logging .Log ;
28
+ import org .apache .commons .logging .LogFactory ;
29
+
27
30
import org .springframework .ws .WebServiceMessage ;
28
31
import org .springframework .ws .context .MessageContext ;
29
32
import org .springframework .ws .server .EndpointInterceptor ;
39
42
*/
40
43
public abstract class AbstractLoggingInterceptor extends TransformerObjectSupport implements EndpointInterceptor {
41
44
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
+
42
51
private boolean logRequest = true ;
43
52
44
53
private boolean logResponse = true ;
@@ -53,6 +62,20 @@ public final void setLogResponse(boolean logResponse) {
53
62
this .logResponse = logResponse ;
54
63
}
55
64
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
+
56
79
/**
57
80
* Logs the request message payload. Logging only ocurs if <code>logRequest</code> is set to <code>true</code>,
58
81
* which is the default.
0 commit comments