a journal of a researcher

Thursday, July 22, 2004

The log4j system

If you do not set log4j system well, you will get warn message when you run axis applications.

You need a log4j configuration file. The configuration file for logging the SOAP relevant information in file “axis.log” is

# Set root logger level to WARN and its only appender to A1.
log4j.rootLogger=WARN, A1
# show DEBUG for SOAPPart method
log4j.logger.org.apache.axis.SOAPPart=DEBUG

# A1 is set to be a ConsoleAppender.
# log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1=org.apache.log4j.FileAppender
log4j.appender.A1.File=axis.log

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

Then you save it in log4j.properties in the directory where the java command runs. Java will find the configuration file and use it automatically. E.g.

Java samples.stock.GetQuote -uuser1 -wpass1 XXX

Or use the option –D to indicate the configuration file:

java -Dlog4j.configuration=file:log4j.properties samples.stock.GetQuote -uuser1 -wpass1 XXX

To open the server side log file for AXIS, put the log4j.properties in

%AXIS_START_DIR%/axis/WEB-INF/classes

You will find the log file at the directory where you start the tomcat server. On my computer is at

%CATALINA_HOME%/bin

(You need option –cp if you did not set the classpath.)

Thanks Michael Sintek to help me understand Log4j and provide the settings for SOAP application.

0 Comments:

Post a Comment

<< Home