Tomcat automatically does its logging, and the logging files are all under /logs
directory. As far as I know, the logging property is /conf/logging.properties
. How can I stop all the logging?

- 3,431
- 20
- 46
- 65
-
4Maybe a better title for this question would be "How can I create a maintenance nightmare?" or "How to make sure no one never noticed problems?" :-) – Aaron Digulla Nov 13 '13 at 17:12
3 Answers
To stop access log (default tomcat setting) go to:
conf/server.xml
and remove the following config:
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
prefix="localhost_access_log." suffix=".txt"
pattern="%h %l %u %t "%r" %s %b" />
to disable common log, go to:
conf/logging.properties
and comment the following line
handlers = 1catalina.org.apache.juli.FileHandler, .....

- 1,849
- 24
- 39
Don't start Tomcat. No Tomcat, no logging.
On a more serious note, don't. Just don't. This sounds like a surefire recipe to cause problems when you're gone, not available or don't remember anymore what you did.
Instead, install a log rotator which deletes old log files after N days.
Also make sure that Tomcat doesn't write too much into catalina.out
since you can't rotate that.
For this, I patch the start script and pipe through head -10000
. Replace this
>> "$CATALINA_OUT" 2>&1 "&"
with
2>&1 | head -10000 >> "$CATALINA_OUT" &
If there is an error starting Tomcat, I'll still see it. But no more than 10'000 lines of log will be written to that file, so it won't grow forever.
Note: Simply deleting catalina.out
will not work. On Windows, it will fail since it's still open. On Unix, only the directory entry will be deleted (making the file inaccessible for anyone except processed which have it open). The file will still take up space on the hard disk and it will continue to grow.
Related articles:

- 321,842
- 108
- 597
- 820
-
http://helpdesk.objects.com.au/java/how-to-stop-logging-to-catalina-out-with-tomcat-6-0. I used this method to disable writing logs to `catalina.out`, but it doesn't work. – Cacheing Nov 13 '13 at 17:36
-
Will it work if I comment out the `handlers` line and `.handlers` line in the `logging.properties` file? – Cacheing Nov 13 '13 at 17:39
-
Please edit your question and add your `logging.properties`. Is Tomcat running on Windows or Linux? – Aaron Digulla Nov 14 '13 at 08:04
-
-
If you're running tomcat in a proper systemd unit with non-forking process, your logs will be handled automatically if put to stdout, so there is no need for a loggin configuration. – Jonathan S. Fisher Sep 03 '18 at 16:44
-
how to prevent tomcat from writing too much into catalina.out? links are broken – Juan Rojas Jul 05 '20 at 05:59
-
There might be legit cases to disable logging. For example if it's handled by a logging framework in the code. – Imaskar Nov 27 '20 at 08:33
-
@Imaskar The problem with Tomcat is that it logs important errors which make it impossible to start your app BEFORE your app's log framework is even loaded. – Aaron Digulla Dec 16 '20 at 15:14
I suggest not to stop logging but to limit it to fixed amount via these steps.
In
.../apache-tomcat.../conf/logging.properties
setjava.util.logging.ConsoleHandler.level = WARNING
.In
.../apache-tomcat.../bin/catalina.sh
replace each mention of
>> "$CATALINA_OUT" 2>&1 "&"
to
2>&1 | tail -1000000 > "$CATALINA_OUT" &
or to this, if you want additionally set filter to write only WARNING
messages:
2>&1 | grep WARNING | tail -1000000 > "$CATALINA_OUT" &
Thus catalina.out
will always contain only last 1000000 lines of logs.

- 61
- 6