Using the log4j system to observe SOAP message

Log4j is an apache project to log run time information. You can use Log4J to observe SOAP message at both client side and server side. More than that, you can also observe other operations Tomcat executes. Be default, this system is not available. You may have already noticed the warn message about the loggers when you run axis applications.

First, save the code in the following block into a file name This log4j configuration file is for logging the SOAP relevant information in file “axis.log”.

# Set root logger level to WARN and its only appender to A1.
log4j.rootLogger=WARN, A1
# show DEBUG for SOAPPart method
# A1 is set to be a ConsoleAppender.
# log4j.appender.A1=org.apache.log4j.ConsoleAppender
# A1 uses PatternLayout.
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

Second, use it for logging client side SOAP messages: Copy 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 samples.stock.GetQuote -uuser1 -wpass1 XXX

You will find the file axis.log at the same directory which records the SOAP messages.

Third, use it for logging server side SOAP messages: Copy the into the directory where axis engine starts:


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



FrontPage/Axis/ViewSOAPMessages (last edited 2009-09-20 22:47:40 by localhost)