logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: unable to setup log4j for tomcat
Date Wed, 05 Oct 2005 15:14:33 GMT
Quoting John Cherouvim <jc@eworx.gr>:

> Hello
>
> I'm pretty new with log4j so excuse me if my question is very basic.
>
> I have managed to setup log4j and call it from a class which I run
> directly from Netbeans. I have configured log4j using a log4j.properties
> in WEB-INF\classes\properties which is contained in the classpath in my


Why WEB-INF/classes/properties?  Are you performing your own manual
configuration, because Log4j's auto-configuration won't find the file unless it
is in the default package.  Secondly, where is log4j.jar?  If it isn't in
WEB-INF/lib but a higher classloader such as CATALINA_HOME/common/lib, then
Log4j has already attempted autoconfiguration at application startup and won't
do it again when you deploy your webapp.  Thirdly, if you have a log4j.xml file
somewhere in your classpath such as CATALINA_HOME/common/classes or in some
miscreant jar packaging its own log4j config file, then Log4j autoconfiguration
will grab the log4j.xml file in preference to your own log4j.properties file
(assuming that you are counting on autoconfiguration and not performing manual
configuration upon application startup).

I suggest looking into each of these issues to see if one of them is the
problem.

Jake

> project
> This one contains:
> log4j.rootLogger=debug, stdout, R
> log4j.appender.stdout=org.apache.log4j.ConsoleAppender
> log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
> log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
> log4j.appender.R=org.apache.log4j.RollingFileAppender
> log4j.appender.R.File=example.log
> log4j.appender.R.MaxFileSize=100KB
> log4j.appender.R.layout=org.apache.log4j.PatternLayout
> log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
>
> Which works great. In my project's folder I can now see a file called
> 'example.log' where I get all my logs.
>
> Now if I run my application from within tomcat no file is created and I
> cannot find the logging that I did when the application run.
> I also tried to do
> log4j.appender.R.File=/usr/local/tomcat5/webapps/test-john-7/example.log
> which is a direct path of the file on the server.
>
> What did miss?
> Regards,
> Ioannis
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>




---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message