How to split the default stdout log?

Thanks Andre!

But when tomcat5 starts, it will generate a file like stdout_yyyymmdd.log, but when it runs for a couple of days, there will be only one file, and all the infos are appended to that file. What I want is that tomcat can automatic generate multiple files such as one file one day so that the single log file will not be so large. Like in log4j, I can set the parameter like “log4j.appender.R=org.apache.log4j.DailyRollingFileAppender” so that everyday it will generate a new file.

in the “logging” tab page, I can only redirect the stdout to a single file.

Does it support parameters like “D:Tomcat 5.5logs{%date%}.log”?

On Tue, Jul 6, 2010 at 4:13 PM, André Warnier wrote:

Leave a comment

3 Comments.

  1. André Warnier

    郑翼羽 wrote:

    I don’t know, and I did not find anything to that effect in the Tomcat or Daemon documentation. But you could try the following :

    In the Apache httpd distribution, there is a program called “rotatelogs.exe”. Its documentation is here : http://httpd.apache.org/docs/2.2/programs/rotatelogs.html

    You could try to download Apache, extract this program, add it to the tomcat/bin directory, and then in tomcat5w.exe try to set the filename to something like :

    |D:/Tomcat 5.5/bin/rotatelogs.exe -l D:/Tomcat 5.5/logs/stdout.%Y.%m.%d 86400

    I have never tried this, and I don’t know if it works. If it does, then let us know, because it might be handy for others.

    Note : I know that this is not the default in the Tomcat installation, but I always recommend to install programs in directory paths *without embedded spaces* (e.g. “D:/tomcat5.5″ instead of “D:/tomcat 5.5″. One of the reasons is shown above : does one need to quote this path or not, and if yes how ?

  2. Thanks.

    The bad news is all the output codes are in a single webapp, and have no hope to use log4j instead of the current “system.out” codes.

    Just I hope to find a way that can make tomcat generate a stdout.log file eveyday, or at any interval.

  3. My Environment:

    Using CATALINA_BASE: D:tomcat5528

    Using CATALINA_HOME: D:tomcat5528

    Using CATALINA_TMPDIR: D:tomcat5528temp

    Using JRE_HOME: D:javajdk1.5.0_12

    Using CLASSPATH: D:tomcat5528binbootstrap.jar

    Server version: Apache Tomcat/5.5.28

    Server built: Jul 24 2009 01:33:09

    Server number: 5.5.28.0

    OS Name: Windows Vista

    OS Version: 6.1

    Architecture: x86

    JVM Version: 1.5.0_12-b04

    JVM Vendor: Sun Microsystems Inc.

    I have used the tomcat unzipped from the zip file, and added it in the system service using “service.bat install”.

    The default setting of the stdout in the Logging tabpage is : auto, at this situation, when tomcat runs, it will generate log file in “D:tomcat5528log” folder, and the related log file name will be “stdout_20100707.log”.

    If I set that box to a fixed file, such as “tomcat.log”, then if tomcat restarts, it will generate a file called “tomcat.log”. Before the next restart (maybe many months), all the output info are appended to that file, which makes the log file to large.

Leave a Reply