This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Web Services and the fly likes Possible for Spring Web Service PayloadLoggingInterceptor to log at other than DEBUG level? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Possible for Spring Web Service PayloadLoggingInterceptor to log at other than DEBUG level?" Watch "Possible for Spring Web Service PayloadLoggingInterceptor to log at other than DEBUG level?" New topic
Author

Possible for Spring Web Service PayloadLoggingInterceptor to log at other than DEBUG level?

Matthew E.
Greenhorn

Joined: Aug 08, 2008
Posts: 2
I'm using org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor per one of the many Googled examples that I've found in an Eclipse Spring Web Service project. Everywhere that I've looked indicates that PayloadLoggingInterceptor will write log messages at DEBUG level, which it does in my app. I would like to use PayloadLoggingInterceptor in my Prod environment but I don't want to capture DEBUG level logging information for performance and file size reasons. Is it possible to configure PayloadLoggingInterceptor and log4j so that it logs at INFO or WARN level? All help is greatly appreciated.


In my web service configuration file I use the following bean:
<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping">
<property name="interceptors">
<bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor" />
</property>
</bean>



My Log4j config:
<?xml version="1.0" encoding="UTF-8" ?>
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

<appender name="FA" class="org.apache.log4j.FileAppender">
<param name="File" value="appLogFile.log"/>
<param name="Threshold" value="DEBUG"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{dd MMM yyyy HH:mm:ss} %-5p %c %x - %m%n" />
</layout>
</appender>


<category name="org.springframework.ws" additivity="false">
<priority value="debug" />
<appender-ref ref="FA" />
</category>
<root>
<priority value ="debug" />
<appender-ref ref="FA" />
</root>

</log4j:configuration>
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
If you take a look at the source of the PayloadLoggingInterceptor, then you can see that the logging is hardcoded to DEBUG level (see logMessagePayload method).
Link to the source code here.
However, nothing stops you from implementing your own version of this class, in which you have other log level - perhaps even a configurable one.
Best wishes!

My free books and tutorials: http://www.slideshare.net/krizsan
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Possible for Spring Web Service PayloadLoggingInterceptor to log at other than DEBUG level?
 
Similar Threads
log4j.xml for app log.
log4j: Why aren't my debug statements showing?
Jboss final start up message not comes up in console
log4j not logging
RollingFileAppender not happening