How to redirect tomcat console log to files? Tomcat started via windows bat

56,065

Solution 1

Edit conf/logging.properties and change this line

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

to

.handlers = 1catalina.org.apache.juli.FileHandler

Then it will only log to catalina.<date>.log, not to the console.

Solution 2

For those to which the accepted answer does not work:

I had the same situation, but I was using (liferay -> tomcat) startup.bat and it always opened up tomcat console. The way to edit the startup.bat file, so that it outputs the log into a file was like this:

Look for the line:

call "%EXECUTABLE%" start %CMD_LINE_ARGS% 

and edit it, so it looks like this:

call "%EXECUTABLE%" run >..\logs\outputfile.log 2>&1 start %CMD_LINE_ARGS% run >..\logs\outputfile.log 2>&1  

You can find your output in the tomcat's logs folder. The file is outputfile.log. The solution is an experimentation with what I found on this page, which was linked from this forum. Good luck.

Share:
56,065

Related videos on Youtube

qwazer
Author by

qwazer

Updated on September 18, 2022

Comments

  • qwazer
    qwazer over 1 year

    When Tomcat is started as service it puts its output log in:

    \logs\stderr.log  
    \logs\stdout.log 
    

    How to write this log files when Tomcat started as BAT in windows?

    P.S.: I tried to start Tomcat with:

    call startup > ../logs/consolelog.log 2<&1
    

    But output of consolelog.log has only 5 lines

    Using CATALINA_BASE:   "C:\Java\Tomcat 5.0"
    Using CATALINA_HOME:   "C:\Java\Tomcat 5.0"
    Using CATALINA_TMPDIR: "C:\Java\Tomcat 5.0\temp"
    Using JRE_HOME:        "C:\Program Files\Java\jdk1.5.0_22"
    Using CLASSPATH:       "C:\Java\Tomcat 5.0\bin\bootstrap.jar"
    

    and lot of output in console

  • Admin
    Admin about 13 years
    it's not work for me
  • Steven McConnon
    Steven McConnon about 9 years
    This didn't work for me though :/
  • Ach J
    Ach J over 5 years
    Did not work though. w/ Tomcat 8 running on Windows as a service
  • Mehdi
    Mehdi about 5 years
    What does the 1 in 1catalina mean ?