Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Adding info about specifying own instances of logger. Also adding info about OSGi specifics.

...

Where loggingCategory is the name of the logging category to use. You can append query options to the URI in the following format, ?option=value&option=value&...

Info
titleUsing Logger instance from the the Registry

As of Camel 2.12.4/2.13.1, if there's single instance of org.slf4j.Logger found in the Registry, the loggingCategory is no longer used to create logger instance. The registered instance is used instead. Also it is possible to reference particular Logger instance using ?logger=#myLogger URI parameter. Eventually, if there's no registered and URI logger parameter, the logger instance is created using loggingCategory.

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

...

Wiki Markup
{div:class=confluenceTableSmall}
|| Option || Default || Type || Description ||
| {{level}} | {{INFO}} | {{String}} | Logging level to use. Possible values: {{ERROR}}, {{WARN}}, {{INFO}}, {{DEBUG}}, {{TRACE}}, {{OFF}} |
| {{marker}} | {{null}} | {{String}} | *Camel 2.9:* An optional [Marker|http://www.slf4j.org/api/org/slf4j/Marker.html] name to use. |
| {{groupSize}} | {{null}} | {{Integer}} | An integer that specifies a group size for throughput logging.|
| {{groupInterval}} | {{null}} | {{Integer}} | If specified will group message stats by this time interval (in millis) |
| {{groupDelay}} | {{0}} | {{Integer}} | Set the initial delay for stats (in millis) |
| {{groupActiveOnly}} | {{true}} | {{boolean}} | If true, will hide stats when no new messages have been received for a time interval, if false, show stats regardless of message traffic | 
| {{logger}} | | {{Logger}} | *Camel 2.12.4/2.13.1:* An optional reference to [org.slf4j.Logger|http://www.slf4j.org/api/org/slf4j/Logger.html] from Registry to use. |
{div}

note: groupDelay and groupActiveOnly are only applicable when using groupInterval

...

Code Block
<to uri="log:foo?param1=foo&amp;param2=100"/>
...
<to uri="log:bar?param1=bar&amp;param2=200"/>

Using Log component in OSGi

Improvement as of Camel 2.12.4/2.13.1

When using Log component inside OSGi (e.g., in Karaf), the underlying logging mechanisms are provided by PAX logging. It searches for a bundle which invokes org.slf4j.LoggerFactory.getLogger() method and associates the bundle with the logger instance. Without specifying custom org.sfl4j.Logger instance, the logger created by Log component is associated with camel-core bundle.

In some scenarios it is required that the bundle associated with logger should be the bundle which contains route definition. To do this, either register single instance of org.slf4j.Logger in the Registry or reference it using logger URI parameter.

Include Page
Endpoint See Also
Endpoint See Also

...