--- Comment #12 from Konstantin Kolinko <[hidden email]> 2011-01-10 18:39:36 EST ---
Moving from Tomcat 4/4.1.24 to Tomcat 7.
My concern is when Tomcat is installed on Windows: it is by default configured
to log err and out to separate files.
Steps to reproduce:
1. Install apache-tomcat-6.0.30.exe with the Examples webapp.
2. Launch Tomcat and navigate to
http://localhost:8080/examples/jsp/simpletag/foo.jsp 3. Look into logs/tomcat6-stdout.2011-01-10.log
Actual result: The file contains the following:
2011-01-10 23:33:27 Commons Daemon procrun stdout initialized
Did you see me on the stderr window?
Did you see me on the browser window as well?
Expected result: The "Did you see me on the stderr window?" message should have
been printed into *stderr* log, not in *stdout* log.
At the same time the tomcat6-stderr.2011-01-10.log file contains a lot of text,
printed by the logging subsystem. It is java.util.logging.ConsoleHandler that
As was noticed earlier, the culprit is Embedded#initStreams() (TC5.5,6,7) and
>> // Replace System.out and System.err with a custom PrintStream
>> SystemLogHandler systemlog = new SystemLogHandler(System.out);
Initialization of JULI happens before this redirection, and thus
java.util.logging.ConsoleHandler prints to the original System.err.
My thoughts of this:
1) SystemLogHandler can be enhanced to support separate out and err streams.
2) If we do not fix this, then maybe configure commons-daemon to log both
streams to the same file by default.
It is done by setting Stderr name in its configuration to be an empty string.
-- See method redirectStdStreams() in prunsrv.c.
3) It is worth being mentioned in the FAQ.
4) This feature is not needed at all if no Context is configured with
"swallowOutput=true". So maybe make it configurable and turn it off by default.
The name for the configuration property might be "redirectStreams", like it is
already used as the field name Embedded#redirectStreams.