You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Dr. Martin Menzel" <ma...@gmail.com> on 2012/01/26 06:55:38 UTC

Separate Logfiles per context

Hello camel fans,

we are getting more an more contexts in our camel and write log files 
(via log4j) from our beans and from camel internal classes.

With the increasing number of contexts and traffic its hard to read the 
log file if we search an error in one special context.

Does anyone had an idea how to separate the log files per context 
without running separate camels in separate vms?

As far as I understood camel tracer does a similar job but is restricted 
to messages generated by camel itself!?

Any hints and ideas are welcome!!

Regards

Martin

Re: Separate Logfiles per context

Posted by "Dr. Martin Menzel" <ma...@gmail.com>.
Am 26.01.2012 11:52, schrieb Łukasz Dywicki:
> Sure you can do that,
> Only one thing you need is logging framework which supports MDC eg log4j or logback.
>
> http://camel.apache.org/mdc-logging.html
>
> Camel pushes then a camelContextId. That allows you to use MDC appender and variables:
>
> log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender
> log4j.appender.sift.appender.file=logs/${camelContextId}/${routeId}.log
>
>
> Best regards,
> Łukasz Dywicki
> --
> Code-House
> http://code-house.org
>
>
>
> Wiadomość napisana przez Dr. Martin Menzel w dniu 2012-01-26, o godz. 06:55:
>
>> Hello camel fans,
>>
>> we are getting more an more contexts in our camel and write log files (via log4j) from our beans and from camel internal classes.
>>
>> With the increasing number of contexts and traffic its hard to read the log file if we search an error in one special context.
>>
>> Does anyone had an idea how to separate the log files per context without running separate camels in separate vms?
>>
>> As far as I understood camel tracer does a similar job but is restricted to messages generated by camel itself!?
>>
>> Any hints and ideas are welcome!!
>>
>> Regards
>>
>> Martin
>
Good hint! Thank you  .... that was what I was looking for

Re: Separate Logfiles per context

Posted by Łukasz Dywicki <lu...@code-house.org>.
Sure you can do that,
Only one thing you need is logging framework which supports MDC eg log4j or logback.

http://camel.apache.org/mdc-logging.html

Camel pushes then a camelContextId. That allows you to use MDC appender and variables:

log4j.appender.sift=org.apache.log4j.sift.MDCSiftingAppender
log4j.appender.sift.appender.file=logs/${camelContextId}/${routeId}.log


Best regards,
Łukasz Dywicki
--
Code-House
http://code-house.org



Wiadomość napisana przez Dr. Martin Menzel w dniu 2012-01-26, o godz. 06:55:

> Hello camel fans,
> 
> we are getting more an more contexts in our camel and write log files (via log4j) from our beans and from camel internal classes.
> 
> With the increasing number of contexts and traffic its hard to read the log file if we search an error in one special context.
> 
> Does anyone had an idea how to separate the log files per context without running separate camels in separate vms?
> 
> As far as I understood camel tracer does a similar job but is restricted to messages generated by camel itself!?
> 
> Any hints and ideas are welcome!!
> 
> Regards
> 
> Martin