Information Management IBM InfoSphere Master Data Management, Version 10.1

Configuring log4j logging on Apache Tomcat

About this task

In these instructions, the following values should be replaced with values specific to your configuration. <<TOMCAT_HOME>> is the directory that Tomcat is installed in, sometimes referred to as CATALINA_HOME.

Procedure

If running Tomcat 6.x:

  1. If you have not already done so, modify the <<TOMCAT_HOME>>/conf/catalina.properties file so that the shared classloader mechanism work the same as Tomcat 5.x.
  2. To do this, verify that the entry beginning with shared.loader= reads shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar If running Tomcat 5.x or higher:

If running Tomcat 5.x or higher:

  1. If it does not already exist, create a "shared/classes" directory under <<TOMCAT_HOME>>.
  2. If it does not already exist, create a "shared/lib" directory under <<TOMCAT_HOME>>.
  3. Copy log4j-###.jar into <<TOMCAT_HOME>>/shared/lib.
    Note: Any specific version of log4j-###.jar should work. You can download the stable log4j version 1.2 installation from http://logging.apache.org/log4j/1.2/download.html
  4. Copy a log4j.properties file into <<TOMCAT>>/shared/classes.

Example

To get a log file named "initiate.log" to show up in the <<TOMCAT_HOME>>/logs directory, an initial version of log4j.properties file is:
log4j.rootLogger=ERROR, R

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout

# Pattern to output the caller's file name and line number.
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=${catalina.home}/logs/initiate.log

log4j.appender.R.MaxFileSize=1000KB
log4j.appender.R.MaxBackupIndex=5

log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%d{ABSOLUTE} 5-5p %c{2} - %m %n

log4j.logger.org.springframework=ERROR
log4j.logger.org.springframework.web.servlet.mvc=ERROR

#set to DEBUG to see hibernate and connection-pool logging output
log4j.logger.org.hibernate=ERROR
log4j.logger.org.apache.commons.dbcp=ERROR

#set to DEBUG to see Initiate-specific logging output
log4j.logger.com.initiatesystems=DEBUG

#set to DEBUG to set Initiate-specific verbose logging output
log4j.logger.verbose=ERROR


Feedback

Timestamp Last updated: 15 Oct 2012

Topic URL: