This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Problem log tomcat6 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Problem log tomcat6" Watch "Problem log tomcat6" New topic
Author

Problem log tomcat6

ilyass kaouam
Greenhorn

Joined: Apr 04, 2013
Posts: 1
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

Joined: Oct 01, 2001
Posts: 2840
    
  11

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

Joined: Jun 25, 2001
Posts: 15960
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problem log tomcat6
 
Similar Threads
virtual hosts in stand alone tomcat
Enable Logging in Tomcat
Why my application on Tomcat works only with localhost?
server.xml - FileLogger and Valve
avoid loading all applications under webapps