org.springframework.integration.handler
Class LoggingHandler

java.lang.Object
  extended by org.springframework.integration.handler.AbstractMessageHandler
      extended by org.springframework.integration.handler.LoggingHandler
All Implemented Interfaces:
org.springframework.core.Ordered, MessageHandler

public class LoggingHandler
extends AbstractMessageHandler

MessageHandler implementation that simply logs the Message or its payload depending on the value of the 'shouldLogFullMessage' property. If logging the payload, and it is assignable to Throwable, it will log the stack trace. By default, it will log the payload only.

Since:
1.0.1
Author:
Mark Fisher

Field Summary
 
Fields inherited from class org.springframework.integration.handler.AbstractMessageHandler
logger
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
LoggingHandler(java.lang.String level)
          Create a LoggingHandler with the given log level (case-insensitive).
 
Method Summary
protected  void handleMessageInternal(Message<?> message)
           
 void setShouldLogFullMessage(boolean shouldLogFullMessage)
          Specify whether to log the full Message.
 
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
getOrder, handleMessage, setOrder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggingHandler

public LoggingHandler(java.lang.String level)
Create a LoggingHandler with the given log level (case-insensitive).

The valid levels are: FATAL, ERROR, WARN, INFO, DEBUG, or TRACE

Method Detail

setShouldLogFullMessage

public void setShouldLogFullMessage(boolean shouldLogFullMessage)
Specify whether to log the full Message. Otherwise, only the payload will be logged. This value is false by default.


handleMessageInternal

protected void handleMessageInternal(Message<?> message)
                              throws java.lang.Exception
Specified by:
handleMessageInternal in class AbstractMessageHandler
Throws:
java.lang.Exception