Class DefaultExchangeFormatter
- java.lang.Object
-
- org.apache.camel.support.processor.DefaultExchangeFormatter
-
- All Implemented Interfaces:
org.apache.camel.spi.ExchangeFormatter
@UriParams @Configurer public class DefaultExchangeFormatter extends Object implements org.apache.camel.spi.ExchangeFormatter
DefaultExchangeFormatterthat have fine grained options to configure what to include in the output.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefaultExchangeFormatter.OutputStyle
-
Constructor Summary
Constructors Constructor Description DefaultExchangeFormatter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Map<String,Object>filterHeaderAndProperties(Map<String,Object> map)Filters the headers or properties before formatting them.Stringformat(org.apache.camel.Exchange exchange)protected StringgetBodyAsString(org.apache.camel.Message message)protected StringgetBodyTypeAsString(org.apache.camel.Message message)intgetMaxChars()DefaultExchangeFormatter.OutputStylegetStyle()booleanisMultiline()booleanisShowAll()booleanisShowAllProperties()booleanisShowBody()booleanisShowBodyType()booleanisShowCaughtException()booleanisShowException()booleanisShowExchangeId()booleanisShowExchangePattern()booleanisShowFiles()booleanisShowFuture()booleanisShowHeaders()booleanisShowProperties()booleanisShowStackTrace()booleanisShowStreams()booleanisSkipBodyLineSeparator()voidsetMaxChars(int maxChars)Limits the number of characters logged per line.voidsetMultiline(boolean multiline)If enabled then each information is outputted on a newline.voidsetShowAll(boolean showAll)Quick option for turning all options on.voidsetShowAllProperties(boolean showAllProperties)Show all of the exchange properties (both internal and custom).voidsetShowBody(boolean showBody)voidsetShowBodyType(boolean showBodyType)Show the body Java type.voidsetShowCaughtException(boolean showCaughtException)If the exchange has a caught exception, show the exception message (no stack trace).voidsetShowException(boolean showException)If the exchange has an exception, show the exception message (no stacktrace)voidsetShowExchangeId(boolean showExchangeId)Show the unique exchange ID.voidsetShowExchangePattern(boolean showExchangePattern)Shows the Message Exchange Pattern (or MEP for short).voidsetShowFiles(boolean showFiles)If enabled Camel will output filesvoidsetShowFuture(boolean showFuture)If enabled Camel will on Future objects wait for it to complete to obtain the payload to be logged.voidsetShowHeaders(boolean showHeaders)Show the message headers.voidsetShowProperties(boolean showProperties)Show the exchange properties (only custom).voidsetShowStackTrace(boolean showStackTrace)Show the stack trace, if an exchange has an exception.voidsetShowStreams(boolean showStreams)Whether Camel should show stream bodies or not (eg such as java.io.InputStream).voidsetSkipBodyLineSeparator(boolean skipBodyLineSeparator)Whether to skip line separators when logging the message body.voidsetStyle(DefaultExchangeFormatter.OutputStyle style)Sets the outputs style to use.
-
-
-
Field Detail
-
LS
protected static final String LS
-
-
Method Detail
-
format
public String format(org.apache.camel.Exchange exchange)
- Specified by:
formatin interfaceorg.apache.camel.spi.ExchangeFormatter
-
filterHeaderAndProperties
protected Map<String,Object> filterHeaderAndProperties(Map<String,Object> map)
Filters the headers or properties before formatting them. No default behavior, but can be overridden.
-
isShowExchangeId
public boolean isShowExchangeId()
-
setShowExchangeId
public void setShowExchangeId(boolean showExchangeId)
Show the unique exchange ID.
-
isShowProperties
public boolean isShowProperties()
-
setShowProperties
public void setShowProperties(boolean showProperties)
Show the exchange properties (only custom). Use showAllProperties to show both internal and custom properties.
-
isShowAllProperties
public boolean isShowAllProperties()
-
setShowAllProperties
public void setShowAllProperties(boolean showAllProperties)
Show all of the exchange properties (both internal and custom).
-
isShowHeaders
public boolean isShowHeaders()
-
setShowHeaders
public void setShowHeaders(boolean showHeaders)
Show the message headers.
-
isSkipBodyLineSeparator
public boolean isSkipBodyLineSeparator()
-
setSkipBodyLineSeparator
public void setSkipBodyLineSeparator(boolean skipBodyLineSeparator)
Whether to skip line separators when logging the message body. This allows to log the message body in one line, setting this option to false will preserve any line separators from the body, which then will log the body as is.
-
isShowBodyType
public boolean isShowBodyType()
-
setShowBodyType
public void setShowBodyType(boolean showBodyType)
Show the body Java type.
-
isShowBody
public boolean isShowBody()
-
setShowBody
public void setShowBody(boolean showBody)
-
isShowAll
public boolean isShowAll()
-
setShowAll
public void setShowAll(boolean showAll)
Quick option for turning all options on. (multiline, maxChars has to be manually set if to be used)
-
isShowException
public boolean isShowException()
-
setShowException
public void setShowException(boolean showException)
If the exchange has an exception, show the exception message (no stacktrace)
-
isShowStackTrace
public boolean isShowStackTrace()
-
setShowStackTrace
public void setShowStackTrace(boolean showStackTrace)
Show the stack trace, if an exchange has an exception. Only effective if one of showAll, showException or showCaughtException are enabled.
-
isShowCaughtException
public boolean isShowCaughtException()
-
setShowCaughtException
public void setShowCaughtException(boolean showCaughtException)
If the exchange has a caught exception, show the exception message (no stack trace). A caught exception is stored as a property on the exchange (using the keyExchange.EXCEPTION_CAUGHTand for instance a doCatch can catch exceptions.
-
isMultiline
public boolean isMultiline()
-
getMaxChars
public int getMaxChars()
-
setMaxChars
public void setMaxChars(int maxChars)
Limits the number of characters logged per line.
-
setMultiline
public void setMultiline(boolean multiline)
If enabled then each information is outputted on a newline.
-
isShowFuture
public boolean isShowFuture()
-
setShowFuture
public void setShowFuture(boolean showFuture)
If enabled Camel will on Future objects wait for it to complete to obtain the payload to be logged.
-
isShowExchangePattern
public boolean isShowExchangePattern()
-
setShowExchangePattern
public void setShowExchangePattern(boolean showExchangePattern)
Shows the Message Exchange Pattern (or MEP for short).
-
isShowStreams
public boolean isShowStreams()
-
setShowStreams
public void setShowStreams(boolean showStreams)
Whether Camel should show stream bodies or not (eg such as java.io.InputStream). Beware if you enable this option then you may not be able later to access the message body as the stream have already been read by this logger. To remedy this you will have to use Stream Caching.
-
isShowFiles
public boolean isShowFiles()
-
setShowFiles
public void setShowFiles(boolean showFiles)
If enabled Camel will output files
-
getStyle
public DefaultExchangeFormatter.OutputStyle getStyle()
-
setStyle
public void setStyle(DefaultExchangeFormatter.OutputStyle style)
Sets the outputs style to use.
-
getBodyAsString
protected String getBodyAsString(org.apache.camel.Message message)
-
getBodyTypeAsString
protected String getBodyTypeAsString(org.apache.camel.Message message)
-
-