File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to define tomcat log file name?

 
jinhua jin
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 17616
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
jinhua jin
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 17616
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The script that normally controls Tomcat under Windows is TOMCAT_HOME\bin\catalina.bat. Take a look at it.
 
jinhua jin
Greenhorn
Posts: 3
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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".

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic