You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Hossein <ma...@csc.com> on 2010/09/13 21:07:48 UTC

log4j not writing to log file

Hello,

I'm trying to setup log4j to write to an output file, but am not
successfull. I get my log messages on console, but the file does not get
created.

log4j.rootLogger=INFO, C, F

# CONSOLE appender 
log4j.appender.C=org.apache.log4j.ConsoleAppender
log4j.appender.C.layout=org.apache.log4j.PatternLayout
log4j.appender.C.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n

# FILE appender 
log4j.appender.F=org.apache.log4j.DailyRollingFileAppender
log4j.appender.F.File=logs/publisher.log
log4j.appender.F.layout=org.apache.log4j.PatternLayout
log4j.appender.F.layout.ConversionPattern=%d{ABSOLUTE} [%5p] - %m%n
log4j.appender.F.DatePattern='.'yyyy-MM-dd


-- 
View this message in context: http://camel.465427.n5.nabble.com/log4j-not-writing-to-log-file-tp2838161p2838161.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: log4j not writing to log file

Posted by ronithomas <ro...@calypso.com>.
Thanks a lot. I was also facing same issue -Dlog4j.debug really helped to
find if the correct log4j file is getting loaded. I had a classpath issue



--
View this message in context: http://camel.465427.n5.nabble.com/log4j-not-writing-to-log-file-tp2838161p5731094.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: log4j not writing to log file

Posted by Hossein <ma...@csc.com>.
I'm using camel 2.2 and mvn camel:run to execute.


-- 
View this message in context: http://camel.465427.n5.nabble.com/log4j-not-writing-to-log-file-tp2838161p2838262.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: log4j not writing to log file

Posted by Stan Lewis <sl...@fusesource.com>.
Add -Dlog4j.debug to your Java command line to see if that helps track
down what's happening, for example maybe your log4j.properties isn't
even getting picked up.

On Mon, Sep 13, 2010 at 3:07 PM, Hossein <ma...@csc.com> wrote:
>
> Hello,
>
> I'm trying to setup log4j to write to an output file, but am not
> successfull. I get my log messages on console, but the file does not get
> created.
>
> log4j.rootLogger=INFO, C, F
>
> # CONSOLE appender
> log4j.appender.C=org.apache.log4j.ConsoleAppender
> log4j.appender.C.layout=org.apache.log4j.PatternLayout
> log4j.appender.C.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
>
> # FILE appender
> log4j.appender.F=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.F.File=logs/publisher.log
> log4j.appender.F.layout=org.apache.log4j.PatternLayout
> log4j.appender.F.layout.ConversionPattern=%d{ABSOLUTE} [%5p] - %m%n
> log4j.appender.F.DatePattern='.'yyyy-MM-dd
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/log4j-not-writing-to-log-file-tp2838161p2838161.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: log4j not writing to log file

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

See src/test/resources in the camel source as we have many
log4j.properties files which writes to files.
https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/resources/

On Mon, Sep 13, 2010 at 9:07 PM, Hossein <ma...@csc.com> wrote:
>
> Hello,
>
> I'm trying to setup log4j to write to an output file, but am not
> successfull. I get my log messages on console, but the file does not get
> created.
>
> log4j.rootLogger=INFO, C, F
>
> # CONSOLE appender
> log4j.appender.C=org.apache.log4j.ConsoleAppender
> log4j.appender.C.layout=org.apache.log4j.PatternLayout
> log4j.appender.C.layout.ConversionPattern=[%30.30t] %-30.30c{1} %-5p %m%n
>
> # FILE appender
> log4j.appender.F=org.apache.log4j.DailyRollingFileAppender
> log4j.appender.F.File=logs/publisher.log
> log4j.appender.F.layout=org.apache.log4j.PatternLayout
> log4j.appender.F.layout.ConversionPattern=%d{ABSOLUTE} [%5p] - %m%n
> log4j.appender.F.DatePattern='.'yyyy-MM-dd
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/log4j-not-writing-to-log-file-tp2838161p2838161.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus