Class DefaultExchangeFormatter

  • All Implemented Interfaces:
    org.apache.camel.spi.ExchangeFormatter

    @UriParams
    @Configurer
    public class DefaultExchangeFormatter
    extends Object
    implements org.apache.camel.spi.ExchangeFormatter
    Default ExchangeFormatter that have fine grained options to configure what to include in the output.
    • Field Detail

      • LS

        protected static final String LS
    • Constructor Detail

      • DefaultExchangeFormatter

        public DefaultExchangeFormatter()
    • Method Detail

      • format

        public String format​(org.apache.camel.Exchange exchange)
        Specified by:
        format in interface org.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 key Exchange.EXCEPTION_CAUGHT and 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
      • isPlain

        public boolean isPlain()
      • setPlain

        public void setPlain​(boolean plain)
        If enabled only the body will be printed out
      • getBodyAsString

        protected String getBodyAsString​(org.apache.camel.Message message)
      • getBodyTypeAsString

        protected String getBodyTypeAsString​(org.apache.camel.Message message)