How do I configure a Tomcat application logging into a separate log file?

Article ID: 1578 
Last Review: Oct,6 2008
Author:
Last updated by: system APPLIES TO:
  • Plesk for Linux/Unix

Resolution

 To configure logging for an application, you should edit needed Host/Context section in server.xml to add Logger:

<Logger className="org.apache.catalina.logger.FileLogger" prefix="domain.com_examples_log." suffix=".txt" timestamp="true"/>

For example logging directived for the examples application on domain.com should looks like:

<Host name="domain.com" debug="0" appBase="webapps" unpackWARs="true">
<Context path="/examples" docBase="examples" debug="0" reloadable="true">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="domain.com_examples_log." suffix=".txt" timestamp="true"/>
</Context>
</Host>

After that, "examples" application for "domain.com" will write log into "domain.com_examples_log.*" files.

See for more information:
http://www.onjava.com/pub/a/onjava/2002/07/31/tomcat.html?page=1


Subscription for this article changesSubscription for this article changes

Please provide feedback on this article

Did this article help you solve your issue?
Yes
No
Partially
I do not know yet
 
Strongly Agree   Strongly Disagree
  9 8 7 6 5 4 3 2 1
The article is easy to understand
The article is accurate
Additional Comments:
*Please provide us with your email address in case we need to contact you.
* - required fields