Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Matthew E.
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using 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="">
<property name="interceptors">
<bean class="" />

My Log4j config:
<?xml version="1.0" encoding="UTF-8" ?>
<log4j:configuration xmlns: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" />

<category name="" additivity="false">
<priority value="debug" />
<appender-ref ref="FA" />
<priority value ="debug" />
<appender-ref ref="FA" />

Ivan Krizsan
Ranch Hand
Posts: 2198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!