You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Meryl Silverburgh <si...@gmail.com> on 2007/06/12 22:41:35 UTC

log4j log file configuraiton

Hi,

I am using log4j for my webapp logging (a servlet in a war file name
'test.war').

The current location of my log files are:
log4j.appender.DEBUG.File=${catalina.base}/debug.log

How can I change it so that it will be put under the directory of my
webapp (e.g. tomcat will create directory 'test' for my 'test.war').
Is there a variable that I can use?

i.e. something like:
log4j.appender.DEBUG.File=${catalina.base}/${web-app-directory}/debug.log

Thank you.

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


Re: log4j log file configuraiton

Posted by Jacob Kjome <ho...@visi.com>.
What I do is reference a property that I know my web application will 
set up for me upon application startup that is uniquely named, but 
predictable.  For instance, if your webapp context is named "MyApp", 
then you'd reference ${MyApp.log.home} and create this property 
*before* manually configuring log4j.

I set up code to generate the system property and value automatically 
in the log4j-sandbox.  I suggest grabbing the alpha2 or alpha3 tag if 
you want a codebase that will compile and deploy against Log4j 
1.2.x.  See my latest updates to the following wiki entry....

http://wiki.apache.org/logging-log4j/AppContainerLogging


Jake

At 03:41 PM 6/12/2007, you wrote:
 >Hi,
 >
 >I am using log4j for my webapp logging (a servlet in a war file name
 >'test.war').
 >
 >The current location of my log files are:
 >log4j.appender.DEBUG.File=${catalina.base}/debug.log
 >
 >How can I change it so that it will be put under the directory of my
 >webapp (e.g. tomcat will create directory 'test' for my 'test.war').
 >Is there a variable that I can use?
 >
 >i.e. something like:
 >log4j.appender.DEBUG.File=${catalina.base}/${web-app-directory}/debug.log
 >
 >Thank you.
 >
 >---------------------------------------------------------------------
 >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