Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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 The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Problem log tomcat6" Watch "Problem log tomcat6" New topic

Problem log tomcat6

ilyass kaouam

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

Joined: Oct 01, 2001
Posts: 2867

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:

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: 16541

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.
I agree. Here's the link:
subject: Problem log tomcat6