tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Eggers <its_toas...@yahoo.com>
Subject Re: Placing a webapp log file aside by other server log files
Date Sun, 03 Jul 2011 21:27:15 GMT
----- Original Message -----

> From: "USHAKOV, Sergey" <s.ushakov@chemitech.ru>
> To: users@tomcat.apache.org
> Cc: 
> Sent: Sunday, July 3, 2011 12:51 PM
> Subject: Placing a webapp log file aside by other server log files
> 
> Hi all,
> 
> I am looking for a robust way to get a webapp-specific log file be placed in the 
> same directory where all the other server logs go.
> 
> Using a line like "org.apache.juli.FileHandler.directory = 
> ${catalina.base}/logs" in the webapp's "logging.properties" 
> does not do the job, as server logs location may be changed from 
> ${catalina.base}/logs to something else by the server's 
> "logging.properties".
> 
> Any ideas?
> 
> Thanks and best regards,
> Sergey 


This is probably not the best way, since it will require you to configure information in two
places (and keep it in sync). However, it should work.

In $CATALINA_BASE/bin/setenv.sh add something like the following to your JAVA_OPTS:

JAVA_OPTS="-Dwebapp.logs=some-directory"
EXPORT JAVA_OPTS

In your web application's logging.properties reference ${webapp.logs}/some-file.

This seems to work reasonably well for me using log4j and commons-logging.

. . . . just my two cents.

/mde/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message