• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

One Log File

 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to figure out how to get all of my logging to use one log file. Currently when I start tomcat as a service it writes to stderr.log, stdout.log as well as a log file I have configured using Log4j. I would like all logs including startup/shutdown logs that are currently going to stdout.log/stderr.log to go to the file I write to using Log4j.


If I start tomcat using catalina.bat it doesn't do this (bc it writes to the console window) but I would like to send all those startup/shutdown messages to the log that Log4j uses if I start tomcat as a service.


Any help would be appreciated.
 
James Ellis
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After toying with this for a while...I can't seem to find a clean solution. It looks like these are the only choices I'm left with.

1) Configure a <Logger> element for the Context that catches any logging not sent to the Log4j log file. This means I would have a stdout.log, stderr.log, log from the <Logger> element, and a log for Log4j. That's a lot of log files...

2) Not configure a <Logger> element for the Context. This means any logging not sent to the Log4j file will go to either stdout.log or stderr.log. Those files could get big and aren't rotated like my Log4j file. Not exactlly ideal either.

3) Don't install Tomcat through the .exe file. Unpackage it, set the environment variables, and set it up as a serivce through a script such as the one mentioned at link setting the same file that Log4j uses for the -out and -err parameters. This means that all logging (startup/shutdown) will go to this one log file. But it also means messing with the install (deviating from the .exe) which scares me a little.

Unless someone has a better idea...I guess it's one of the three above.

Thanks,
Jim
 
reply
    Bookmark Topic Watch Topic
  • New Topic