<p>There is Tomcat configuration file for the logging: <code>TOMCAT_HOME/conf/logging.properties</code>.
Edit the file and remove all the handlers except the console handler:</p>

<pre><code>.handlers = java.util.logging.ConsoleHandler
</code></pre>

<p>This will direct all logging to the console, <strong>except</strong> for access logs (localhost_access_log.XXXX.txt). It is always written to file by the AccessLogValve, configured in 'server.xml'. To redirect that one you need to configure own implementation of the AbstractAccessLogValve... which requires coding.</p>

CC BY-SA 4.0
2019-12-13T06:34:32.073Z
2019-12-13T06:34:32.073Z
Dimitar II
<p>That <a href="https://tomcat.apache.org/tomcat-7.0-doc/logging.html#Console" rel="nofollow noreferrer">doc</a> say next:</p>
<blockquote>
<p>When running Tomcat on unixes, the console output is usually redirected to the file named catalina.out. The name is configurable using an environment variable. (See the startup scripts). Whatever is written to System.err/out will be caught into that file. That may include:</p>
<p>Uncaught exceptions printed by</p>
<ul>
<li><p>java.lang.ThreadGroup.uncaughtException(..)</p>
</li>
<li><p>Thread dumps, if you requested them via a system signal</p>
</li>
</ul>
<p>When running as a service on Windows, the console output is also caught and redirected, but the file names are different.</p>
<p>The default logging configuration in Apache Tomcat writes the same messages to the console and to a log file. This is great when using Tomcat for development, but usually is not needed in production.</p>
</blockquote>
<p>So if you need to catch the same logs which catch analytic software you need read <code>catalina.out</code> file.</p>
<p>Think it's will be helpful to you.</p>

CC BY-SA 4.0
2018-11-02T14:17:08.187Z
catalina.out already goes to console... I'm looking to find a way to get localhost.log and catalina.log out to console too.
Scott Shorkey
CC BY-SA 4.0
2018-10-27T19:04:36.327Z
2018-10-27T19:04:36.327Z
2020-06-18T08:28:10.803Z
Ivan Gurzhiy
<p>So I have a problem that is the reverse of what everyone else on the internet wants.. I want to take tomcat logs that are being written out to /usr/local/tomcat/logs and have them be output to console instead. (Everyone else is asking the reverse.. how to get things away from console and to file). Reason why is because I'm on a system that captures output to console and directs it to an analytics program, it has to go to this program, and I have no control over how this is designed (ie. I can't change the program or capture process to use files as well as console).</p>

<p>To clarify, I am doing this on a Linux system, specifically Alpine.</p>

<linux><logging><tomcat>
How to redirect tomcat logs TO console?
Scott Shorkey
# How to redirect tomcat logs TO console?

(Asked by: username_0 on 2018-10-25)

So I have a problem that is the reverse of what everyone else on the internet wants.. I want to take tomcat logs that are being written out to /usr/local/tomcat/logs and have them be output to console instead. (Everyone else is asking the reverse.. how to get things away from console and to file). Reason why is because I'm on a system that captures output to console and directs it to an analytics program, it has to go to this program, and I have no control over how this is designed (ie. I can't change the program or capture process to use files as well as console).

To clarify, I am doing this on a Linux system, specifically Alpine.

**Tags:** linux, logging, tomcat


---

## 2 answers

### Answer by username_1 on 2019-12-13. Score: 3

There is Tomcat configuration file for the logging: TOMCAT_HOME/conf/logging.properties.
Edit the file and remove all the handlers except the console handler:
.handlers = java.util.logging.ConsoleHandler

This will direct all logging to the console, except for access logs (localhost_access_log.XXXX.txt). It is always written to file by the AccessLogValve, configured in 'server.xml'. To redirect that one you need to configure own implementation of the AbstractAccessLogValve... which requires coding.


---

### Answer by username_2 on 2018-10-27. Score: 1

That [doc](https://tomcat.apache.org/tomcat-7.0-doc/logging.html#Console) say next:

> When running Tomcat on unixes, the console output is usually redirected to the file named catalina.out. The name is configurable using an environment variable. (See the startup scripts). Whatever is written to System.err/out will be caught into that file. That may include:
>
> Uncaught exceptions printed by
>
> * java.lang.ThreadGroup.uncaughtException(..)
> * Thread dumps, if you requested them via a system signal
>
> When running as a service on Windows, the console output is also caught and redirected, but the file names are different.
>
> The default logging configuration in Apache Tomcat writes the same messages to the console and to a log file. This is great when using Tomcat for development, but usually is not needed in production.

So if you need to catch the same logs which catch analytic software you need read `catalina.out` file.

Think it's will be helpful to you.

> **Comments:**
> **username_0**: catalina.out already goes to console... I'm looking to find a way to get localhost.log and catalina.log out to console too.  

---

