...
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 |
---|---|---|---|
| | | Logging level to use. Possible values: |
| | | 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 |
---|---|---|
| | quick Quick option for turning all options on. |
| | To output Show the unique exchange id ID. |
| | Output Show the exchange properties. |
| | Output Show the in In message headers. |
| | Output Show the in In body Java type. |
| | Output Show the in In body. |
| | If the exchange has an out message then its also shown Out message, show the Out message. |
| | Camel 2.0: If the exchange has an exception then , show the exception message is shown (no stacktracestack trace). |
| | 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 |
| | Camel 2.0: Show also the stacktrace stack trace, if the an exchange has an exception. |
| | if enabled then each If |
|
| 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 | ||||
---|---|---|---|---|
| ||||
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 | ||||
---|---|---|---|---|
| ||||
<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.
...