File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Possible for Spring Web Service PayloadLoggingInterceptor to log at other than DEBUG level?