Because the log-component delegates to an underlying logging framework using
sl4j, it should be possible to change the log format of that underlying
logger.
Jan
/log4j.properties
log4j.appender.camel=org.apache.log4j.ConsoleAppender
log4j.appender.camel.layout=org.apache.log4j.PatternLayout
log4j.appender.camel.layout.ConversionPattern=%d %-5p %-30.30c{1} - %m%n
log4j.logger.de.materne.camel.log=DEBUG
-----
public class LogTest extends CamelTestSupport {
@Test
public void log() {
template.sendBody("direct:in", "Test message");
}
@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
@Override
public void configure() throws Exception {
from("direct:in")
.to("log:de.materne.camel.log")
.to("mock:end");
}
};
}
}
> -----Ursprüngliche Nachricht-----
> Von: Reji Mathews [mailto:[email protected]]
> Gesendet: Dienstag, 7. Januar 2014 11:54
> An: [email protected]
> Betreff: Re: Add date to logs
>
> Hi Satyam. Probably you can use Camel Simple (Refer on
> http://camel.apache.org/simple.html) . You can embed the date function
> into the camel log string
>
>
> On Tue, Jan 7, 2014 at 3:03 PM, Satyam Maloo <[email protected]>
> wrote:
>
> > Hi,
> >
> > Currently I am logging the operations as :
> >
> > <camel:to uri="log:Operation:Started Processing
> >
> >
> Requests?level=DEBUG&showAll=true&multiline=true&showBody=t
> rue&showHeaders=true"
> > />
> >
> > Now, I want to add date to log. How do I do that?
> >
> >
> >
> > -----
> > Satyam A Maloo
> > --
> > View this message in context:
> > http://camel.465427.n5.nabble.com/Add-date-to-logs-tp5745662.html
> > Sent from the Camel - Users mailing list archive at Nabble.com.
> >