陳冠昇
陳冠昇

Reputation: 21

How do I move Tomcat catalina.out log to a different directory

I have a Tomcat7 server and I'd like to move the catalina.out log to a different directory than ${catalina.base}/logs.

  1. The approach of changing CATALINA_OUT environment variable doesn't work How do I change the path to catalina.out?, I've modified it and I'm sure the environment variable is set to CATALINA_OUT="$MY_PATH/catalina.out" before the server startup, but catalina.out stays still in ${catalina.base}/logs

  2. The conf/logging.properties doesn't specify such property for catalina.out, this had been brought up in many similar discussion posts.

Is there any folks also met such problem recently or before ?

Upvotes: 1

Views: 2030

Answers (1)

Du-Lacoste
Du-Lacoste

Reputation: 12807

You could change the Tomcat Log Locations as below:

Go to: <tomcat-base>/conf/logging.properties and replace <add_location_you_prefer> with what you require;

catalina.org.apache.juli.AsyncFileHandler.level = FINE
catalina.org.apache.juli.AsyncFileHandler.directory = <add_location_you_prefer>
catalina.org.apache.juli.AsyncFileHandler.prefix = catalina.

localhost.org.apache.juli.AsyncFileHandler.level = FINE
localhost.org.apache.juli.AsyncFileHandler.directory = <add_location_you_prefer>
localhost.org.apache.juli.AsyncFileHandler.prefix = localhost.

manager.org.apache.juli.AsyncFileHandler.level = FINE
manager.org.apache.juli.AsyncFileHandler.directory = <add_location_you_prefer>
manager.org.apache.juli.AsyncFileHandler.prefix = manager.

host-manager.org.apache.juli.AsyncFileHandler.level = FINE
host-manager.org.apache.juli.AsyncFileHandler.directory = <add_location_you_prefer>
host-manager.org.apache.juli.AsyncFileHandler.prefix = host-manager.

Lastly you will need to change the catalina.out:

Find the following code snippet in Catalina.sh script in bin directory of your tomcat base location and change the

CATALINA_OUT="$CATALINA_BASE"/logs/catalina.out to:

CATALINA_OUT=<add_location_you_prefer>/catalina.out

Upvotes: 1

Related Questions