We have a forum dedicated specifically to
Tomcat, so that's really a better place to ask Tomcat-related questions.
stdout and stderr aren't really "logfiles". They are the JVM's standard writers after the time-honored architecture initially defined bu Unix and later adopted by DOS, Windows and Linux (among other OS's). As such, they contain literally what was contained in the argument of the System.out or System.err print/println statement, no more and no less. Well, except that println appends an OS-specific end-of-line character sequence to the output, anyway,
True loggers such as log4j channel the log print requests, categorizing them and routing them to log outputs, allowing stuff like timestamps to be automatically added along the way. You can select or suppress specific topics as needed. This is why we discourage using stdout in web applications in favor of logging. Also because the
J2EE and JEE specs don't actually support the concept of stdout/stderr, so for a given webserver, there's no telling where the stdout and stderr output might show up. If it shows up at all.
The Tomcat server uses its own logger in addition to the stdout console file (which is usually named catalina.out). ONLY Tomcat internal messages go to that logger, however. Each webapp is responsible for its own logging setup independent of the logging environment of the Tomcat server.
It's actually fairly easy to automate conversion to log4j. Just create a log4j config file in the WEB-INF/classes directory to define what should go where, add something like the following statement to each class to be logged:
along with the import for org.apache.log4j.Logger. Then do a bulk edit/replace of "System.out.println(" with "log.info(". You can replace System.err.println with "log.error(". In cases where "print()" is used instead of "println()", then it's best to fix on a case-by-case basis, but the MessageFormat class can assist in creating a loggable message
string.
Incidentally, I set up a hotkey in my
IDE that automatically inserts the import and logger definition for a class, since I do it so often. Saves a lot of typing!