aspose 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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Web Services
Reply 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
Bartender

Joined: Oct 04, 2006
Posts: 2193
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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Possible for Spring Web Service PayloadLoggingInterceptor to log at other than DEBUG level?
 
Similar Threads
RollingFileAppender not happening
log4j.xml for app log.
log4j not logging
log4j: Why aren't my debug statements showing?
Jboss final start up message not comes up in console