How do I configure Tomcat so that my error messages come up in a file, not in the console?

Alessandro A. Garbagnati

The reason why you are getting the error message on the console and not on a file is because the default configuration of the tomcat.log file is set to be redirected to the console, instead of a file.

To change this you don't need to edit the startup.bat or startup.sh file, but the server configuration file, that is located under the conf directory, normally named server.xml.

As stated in the top of the file:

        if you don't want messages on screen, add the attribute
        path="logs/tomcat.log" to the Logger element below
So, you just have to change the lines below this comment to something like this:

    <Logger name="tc_log"
            verbosityLevel = "INFORMATION" />
If you read the top of this configuration file, there are also some interesting information on how to handle the location of all the log files.