You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "USHAKOV, Sergey" <s....@chemitech.ru> on 2011/07/03 21:51:51 UTC

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 


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


Re: Placing a webapp log file aside by other server log files

Posted by "USHAKOV, Sergey" <s....@chemitech.ru>.
----- Original Message ----- 
From: "Mark Eggers" <it...@yahoo.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Monday, July 04, 2011 1:27 AM
Subject: Re: Placing a webapp log file aside by other server log files


> ----- Original Message -----
>
>> From: "USHAKOV, Sergey" <s....@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/
>

Thank you Mark. Though that does not look like a solution I might be willing 
to get :) , this will definitety do the job if no other solution is found...

Thanks again,
Sergey 


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


Re: Placing a webapp log file aside by other server log files

Posted by Mark Eggers <it...@yahoo.com>.
----- Original Message -----

> From: "USHAKOV, Sergey" <s....@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