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

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.