Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem log tomcat6

 
ilyass kaouam
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
after a day of searching I cannot solve my problem!
In fact on my server.xml I have two web app as following:



I would like a log file (logs System.out and / or System.err.) For each application (instead of having them all in catalina.out).
with Access log it works perfect, but it does not work with logFile
I tried the following configuration, but the files have not been created

<

Have an idea?
Thank you in advance.
 
Greg Charles
Sheriff
Posts: 2993
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Illyass, and welcome to JavaRanch!

We see this question from time to time and the answer really is: don't write to standard out (stdout) or standard err (stderr) from a web app. Actually, writing to stdout and stderr is almost always a bad idea. You should be using a logging framework instead. The one recommended by Apache is, not surprisingly, Apache Commons Logging. See the Tomcat Logging FAQ here: http://wiki.apache.org/tomcat/FAQ/Logging

Logging isn't really that hard to configure, and it's a long-established best practice. Retrofitting all your System.print statements to log statements may be the hardest part, depending how many there are, but it'll be worth it. I promise!
 
Tim Holloway
Saloon Keeper
Posts: 18303
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the best arguments for using a real logger instead of the System output/error streams is that there's no guarantee in J2EE where System.out and System.err output will go. In a few cases, it even gets totally discarded. J2EE is not required to support the stdio data streams and it doesn't. Cases where it pretends to are extremely implementation-dependent.

In contrast, if you set up a logger for a webapp, you know exactly where the output will go.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic