It's all about the answers!

Ask a question

Capturing stdout and stderr on Tomcat


Martha (Ruby) Andrews (3.0k44351) | asked Jun 19 '12, 12:22 p.m.
JAZZ DEVELOPER
How do I capture stdout and stderr on Tomcat, similar to SystemOut.log and SystemErr.log from WAS?

Martha
Jazz L3 Developer

Accepted answer


permanent link
Martha (Ruby) Andrews (3.0k44351) | answered Jun 19 '12, 12:23 p.m.
JAZZ DEVELOPER

Tomcat has separate files for the server itself and each of the applications.
stdout and stderr for Tomcat is echoed to these files:
<CLM_HOME>/server/tomcat/logs/catalina.2012-06-15.log
<CLM_HOME>/server/tomcat/logs/localhost.2012-06-15.log
where the text in italics is the date when tomcat was started.


The output for applications is managed by each application. QM, RM and admin (LPA) all echo stdout (but not stderr) to their log files by default:
<CLM_HOME>/server/logs/qm.log
<CLM_HOME>/server/logs/rm.log
<CLM_HOME>/server/logs/admin.log

CCM and JTS do not echo stdout to a log file by default. Each of those applications has a file called log4j.properties that can be modified to echo stdout.
   Open <CLM_HOME>/server/conf/application/log4j.properties for editing
      where application is either jts or ccm
   Comment out this line:
     log4j.rootLogger=WARN, file
   Uncomment this line:
     log4j.rootLogger=WARN, stdout, file
   Restart tomcat
  
None of the applications echos stderr.  To do that, the log4j.properties file for each application must be changed.
   Open <CLM_HOME>/server/conf/application/log4j.properties for editing
      where application is either jts, ccm, qm, rm, admin
   Add these lines:
###############################
#   stderr Appender            #
################################
log4j.appender.stderr=org.apache.log4j.ConsoleAppender
log4j.appender.stderr.layout=org.apache.log4j.PatternLayout
# Pattern to output the caller's file name and line number.
log4j.appender.stderr.layout.ConversionPattern=%d{ISO8601} [%t] %5p %-50.50c  - %m%n
   Restart tomcat
Jared Burns selected this answer as the correct answer

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.