Hi all,

Since markers are part of SLF4J's public API, you can invoke logger
print method with markers.

As Michael mentioned you can write:

  Marker blueMarker = MarkerFactory.getMarker( "blue" );
  logger.warn( blueMarker , "my log message" );

If logback is the underlying logging framework, SLF4J will invoke
logback handing it the blueMarker as well as the "log message" along
with other relevant data. For other logging systems, the marker will
be ignored. Assuming logback is the underlying logging framework, the
user is free to filter log events based on the available marker data.

While Camel should not assume that logback is the underlying logging
framework, it can log with markers if the user asks it to do so.

Here is an example:

<camel:log message="Received message"
           logName="com.app.CamelReport"
           marker="someRouteDependentValue"
           loggingLevel="INFO"/>



Here I am assuming that <camel:log> is part of a route definition
where "someRouteDependentValue" is known in that context. This would
allow the user to log messages based on the route. It's just an
example. I know very little about camel so this example might not make
sense.

Regardless of whether logback is the underlying framework, SLF4J api
allows you to log with marker data. The marker data can be put to use
by logback and will be ignored by other frameworks.

Best regards,

--
Ceki
http://twitter.com/#!/ceki

Reply via email to