tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: How to split the default stdout log?
Date Tue, 06 Jul 2010 08:58:54 GMT
郑翼羽 wrote:
> 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.5\logs\{%date%}.log"?

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

In the Apache httpd distribution, there is a program called "rotatelogs.exe".
Its documentation is here :

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 ?

> On Tue, Jul 6, 2010 at 4:13 PM, André Warnier <> wrote:
>> 郑翼羽 wrote:
>>> Hello everyone,
>>> I am using Tomcat 5.5.28 in Windows systems. Because there are lots of
>>> codes
>>> like "System.out.println(" some info here")" in the apps, after a few days
>>> the file  "stdout_*.log" in the "/logs" folder becomes so large that we
>>> cannot open it. Due to some reasons, I cannot modify the codes, so the
>>> only
>>> solution is to make the log generated everyday.
>>> I have tried the log4j, but I cannot redirect the stand output to the log
>>> files. Only there log infos that send out by logging class can be recorded
>>> in the logs generated by log4j.
>>> Anyone know a simple solution to meet my needs?
>>>  Hi.
>> You do not say, but I presume that you are running Tomcat 5.5 as a Windows
>> Service.
>> If so, then Tomcat (or rather the JVM which runs Tomcat), is running inside
>> of a "wrapper" program called "tomcat5.exe" (tomcat_dir/bin/tomcat5.exe).
>> This program "catches" the stdout/stderr of the JVM, and redirects them to
>> files.
>> To which files it redirects them, is stored in the Windows Registry.
>> When tomcat5.exe starts, it reads a series of parameters from the Registry,
>> and then starts the JVM (and Tomcat) using these parameters.
>> There is another program in tomcat_dir/bin, called "tomcat5w.exe".
>> This is a GUI which enables you to change these Registry parameters used by
>> tomcat5.exe.
>> Double-click on the tomcat5w.exe program, and navigate to the "Logging"
>> tab.
>> Maybe this gives you an idea.
>> For a complete explanation, start here :
>> tomcat5.exe is really a renamed prunsrv
>> tomcat5w.exe is really a renamed prunmgr
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message