wood burning stoves*
The moose likes Tomcat and the fly likes How to define tomcat log file name? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How to define tomcat log file name?" Watch "How to define tomcat log file name?" New topic
Author

How to define tomcat log file name?

jinhua jin
Greenhorn

Joined: Dec 27, 2011
Posts: 3
Dear Experts,

We have a tomcat project which runs on windows.
And we are planing to upgrade tomcat version to 7.
In our development environment, after upgrade to tomcat7,
we found the log file name was changed from
stdout_yyyymmdd.log to <productname>-stdout.yyyy-mm-dd.log.

What should we do to keep the current log file name?

Any help or advice is appriciated.

Thanks in advance.

Jinhua
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

Welcome to the JavaRanch, Jinhua!

The stdout from Tomcat is actually traditionally written to TOMCAT_HOME/logs/catalina.out. But because it is stdout, even that is only because the script that launches Tomcat has a redirection on the "java" command line.

You should be able to alter that script any way you like (as long as you understand what you are doing!)

My guess as to why the name change is that it probably makes it easier to run multiple copies of Tomcat, where each logfile's name corresponds to the name of the Tomcat that is writing it.


Customer surveys are for companies who didn't pay proper attention to begin with.
jinhua jin
Greenhorn

Joined: Dec 27, 2011
Posts: 3
Thank you Tom.

I'm afraid I haven't understood what you meant.
Do you mean I can change file name using java command?
If yes, could you kindly tell me the command what I should use?

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

The script that normally controls Tomcat under Windows is TOMCAT_HOME\bin\catalina.bat. Take a look at it.
jinhua jin
Greenhorn

Joined: Dec 27, 2011
Posts: 3
The application is registered as a Windows service.
And I could change the name of log file by changing the following value of in the registory.

value: StdOutput
data: auto ->%CATALINA_HOME%\logs\stdout.log

My goal is to output as stdout_yyyymmdd.log.

Setting %CATALINA_HOME%\logs\stdout_%y%d%m.log made the file's name output as "stdout_%y%d%m.log" and not "stdout_yyyymmdd.log".

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to define tomcat log file name?