You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by imranrazakhan <im...@gmail.com> on 2014/04/30 18:00:18 UTC
Log4j in Camel Standalone Application
Hi,
I tried to configure log4.properties in my standalone application, it shows
on console but i am unable to see it in file, following is my code
Main Class:-
public static void main(String[] args) throws Exception {
Main main = new Main();
main.enableHangupSupport();
main.addRouteBuilder(new TestLogRoute());
main.run();
} //EO main
TestLogRoute Class:-
public void configure() throws Exception {
from("timer://foo?delay=0&period=20000")
.log(LoggingLevel.INFO,"Log Configured MT ${body}");
}
Following is my log4j.properties under com.my.test.resources
log4j.rootLogger=info, stdout, R
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{dd-MMM-yyyy HH:mm:ss:SSS}
%5p [%t] - %m%n
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=d:\\logs\\testlogs.log
log4j.appender.R.MaxFileSize=15000KB
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d %5p [%t] - %m%n
Regards,
--
View this message in context: http://camel.465427.n5.nabble.com/Log4j-in-Camel-Standalone-Application-tp5750730.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Log4j in Camel Standalone Application
Posted by imranrazakhan <im...@gmail.com>.
Hi Willem,
Thanks issue resolved.
Regards
--
View this message in context: http://camel.465427.n5.nabble.com/Log4j-in-Camel-Standalone-Application-tp5750730p5750828.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Log4j in Camel Standalone Application
Posted by Willem Jiang <wi...@gmail.com>.
Can you check if you put the slf4j-log4j12 jar into your class path?
--
Willem Jiang
Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem
On May 1, 2014 at 12:00:50 AM, imranrazakhan (imranrazakhan@gmail.com) wrote:
> Hi,
>
> I tried to configure log4.properties in my standalone application, it shows
> on console but i am unable to see it in file, following is my code
>
> Main Class:-
>
> public static void main(String[] args) throws Exception {
>
> Main main = new Main();
> main.enableHangupSupport();
> main.addRouteBuilder(new TestLogRoute());
> main.run();
>
> } //EO main
>
> TestLogRoute Class:-
>
> public void configure() throws Exception {
> from("timer://foo?delay=0&period=20000")
> .log(LoggingLevel.INFO,"Log Configured MT ${body}");
> }
>
> Following is my log4j.properties under com.my.test.resources
> log4j.rootLogger=info, stdout, R
>
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=%d{dd-MMM-yyyy HH:mm:ss:SSS}
> %5p [%t] - %m%n
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=d:\\logs\\testlogs.log
> log4j.appender.R.MaxFileSize=15000KB
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%d %5p [%t] - %m%n
>
> Regards,
>
>
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Log4j-in-Camel-Standalone-Application-tp5750730.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
Re: Log4j in Camel Standalone Application
Posted by imranrazakhan <im...@gmail.com>.
Hi,
In my main class i added following line, due to this i can see a new log
file created but no output in that file
PropertyConfigurator.configure("log4j.properties");
Regards,
--
View this message in context: http://camel.465427.n5.nabble.com/Log4j-in-Camel-Standalone-Application-tp5750730p5750819.html
Sent from the Camel - Users mailing list archive at Nabble.com.