Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Minor copy edits and reworked the text under the 'URI Format' heading.

...

Code Block
log:loggingCategory[?level=loggingLevel][options]

Where loggingCategory is the name of the logging category to use and loggingLevel is the logging level such as DEBUG, INFO, WARN, ERROR - the default is INFO. You can append query options to the URI in the following format, ?option=value&option=value&...

For example, a log endpoint typically specifies the logging level using the level option, as follows:

Code Block

log:org.apache.camel.example?level=DEBUG

The default logger logs every exchange (regular logging). But Camel also ships with the Throughput logger, which is used whenever By default Camel uses a regular logging that logs every exchange. However Camel also ships with a Throughput logger that is used if the groupSize option is specified.

...

Option

Default

Type

Description

level

INFO

String

Logging level to use. Possible values: FATAL, ERROR, WARN, INFO, DEBUG, TRACE, OFF

groupSize

null

Integer

An integer that specifies a group size for throughput logging. By default, regular logging is used.

Formatting

The log formats the execution of exchanges to log lines.
The By default, the log uses by default LogFormatter to format the log output., where LogFormatter has the following options:

Option

Default

Description

showAll

false

quick Quick option for turning all options on.

showExchangeId

false

To output Show the unique exchange id ID.

showProperties

false

Output Show the exchange properties.

showHeaders

false

Output Show the in In message headers.

showBodyType

true

Output Show the in In body Java type.

showBody

true

Output Show the in In body.

showOut

false

If the exchange has an out message then its also shown Out message, show the Out message.

showException

false

Camel 2.0: If the exchange has an exception then , show the exception message is shown (no stacktracestack trace).

showCaughtException

false

Camel 2.0: If the exchange has a caught exception then , show the exception message is shown (no stacktracestack trace). A caught exception is stored as a property on the exchange , and for instance a doCatch can catch exceptions. See Try Catch Finally.

showStackTrace

false

Camel 2.0: Show also the stacktrace stack trace, if the an exchange has an exception.

multiline

false

if enabled then each If true, each piece of information is logged on a new line.

maxChars

 

Camel 2.0: Is used to limit Limits the number of chars characters logged per line.

Regular logger sample

In the route below we logs log the incoming orders at DEBUG level before the order is processed.:

Code Block
java
java
from("activemq:orders").to("log:com.mycompany.order?level=DEBUG").to("bean:processOrder");

And Or using Spring DSL as XML to define the route:

Code Block
xml
xml
  <route>
    <from uri="activemq:orders"/>
    <to uri="log:com.mycompany.order?level=DEBUG"/>
    <to uri="bean:processOrder"/>
  </route> 

Regular logger with formatter sample

In the route below we logs log the incoming orders at INFO level before the order is processed.

...

In the route below we log the throughput of the incoming orders at DEBUG level grouped by 10 messages.

...