Thanks very much Raul !

2013/4/12 Raul Kripalani <r...@evosent.com>

> Hi Jean Francois,
>
> What you need is exactly the SiftAppender, which will log to a different
> file depending on some dynamic parameter in the Mapped Diagnostic Context
> (MDC).
>
> Use this appender from log4j: org.apache.log4j.sift.MDCSiftingAppender.
>
> In the Camel route, write a custom processor that sets an MDC parameter
> named "camel.filename" with the CamelFileName header as the value.
>
> In your log4j configuration, you can then configure your MDCSiftingAppender
> like this:
>
>    log4j.appender.sift.appender.file=log/$\\{camel.filename\\}.log
>
> Here's a blog post showing how SMX achieves per-bundle logging [1], which
> can serve as a reference.
>
> Remember that the MDC context is attached to a thread, so when the thread
> is reused by the Camel File endpont, it'll still have the old MDC context.
> I suggest you do some housekeeping and clean up the MDC property after the
> last log output in the route (by inserting another Processor straight
> after, or using an AsyncCallback like in
> org.apache.camel.impl.MDCUnitOfWork).
>
> Hope this helps.
>
> [1]
>
> http://jason-sherman.blogspot.com.es/2012/06/serivcemix-configuring-sift-appender.html
> .
>
> *Raúl Kripalani*
> Enterprise Architect, Open Source Integration specialist, Program
> Manager | Apache
> Camel Committer
> http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
> http://blog.raulkr.net | twitter: @raulvk
>
> On Fri, Apr 12, 2013 at 1:23 PM, Jean Francois LE BESCONT <
> jflebesc...@gmail.com> wrote:
>
> > Thanks for the answer Christian,
> >
> > After re-read my question, I think that I am not enough specific and not
> > explain correctly my point. :)
> >
> > In my case I scan a directory and would like to produce one log ( logEIP
> )
> >  file per file processed.
> >
> > something like :
> >
> > from("file://C:/test)
> >      .log("found ${file:name}")
> >      .process(myprocess1)
> >      .log("end processed1  ${file:name}")
> >      .process(myprocess2)
> >      .log("end processed2  ${file:name}")
> > .end();
> >
> > I have a classical log4j.properties
> >
> > log4j.rootLogger=INFO, A1
> > log4j.appender.A1=org.apache.log4j.FileAppender
> > log4j.appender.A1.File=mylogfile.log
> > log4j.appender.A1.layout=org.apache.log4j.PatternLayout
> > log4j.appender.A1.layout.ConversionPattern=%d{dd/MM/yyyy HH\:mm\:ss,SSS}
> > %-5p [%t] - %m%n
> >
> >
> > Adn I would like to do something like :
> >
> >   props.setProperty("log4j.appender.file.File","<camel current file
> > name>.log");
> >       LogManager.resetConfiguration();
> >       PropertyConfigurator.configure(props);
> >      }
> >
> > But with no specific process, is it possible ?
> >
> > thanks
> >
> >
> >
> >
> >
> >
> >
> > 2013/4/11 Christian Müller <christian.muel...@gmail.com>
> >
> > > You can configure it in your logging framework.
> > >
> > > Sent from a mobile device
> > > Am 11.04.2013 13:12 schrieb "jeff" <jflebesc...@gmail.com>:
> > >
> > > Hey !
> > >
> > > I think that it is not possible, but is it possible to send log
> message :
> > >
> > >
> > >
> >
> from("activemq:orders").to("log:com.mycompany.order?level=DEBUG").to("bean:processOrder");
> > >
> > > in a file ?
> > >
> > > Something like :
> > >
> > >
> > >
> >
> from("activemq:orders").to("log:com.mycompany.order?level=DEBUG&file=log/${file:name}.log
> > > ").to("bean:processOrder");
> > >
> > >
> > >
> > > Thanks !
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > > http://camel.465427.n5.nabble.com/Log-in-file-tp5730713.html
> > > Sent from the Camel - Users mailing list archive at Nabble.com.
> > >
> >
>

Reply via email to