How to log SOAP messages for a Tomcat/Axis Web Service

If you have a web service running under Tomcat using Axis framework and you would like to log all the soap requests and responses, and this can be done by adding the following entries in the sever-config.wsdd file

Add Handler entries

<handler name=”log” type=”java:org.apache.axis.handlers.LogHandler”> <parameter name=”LogHandler.fileName” value=”axis.log” /> </handler>

under Global Configuration tag

<parameter name=”disablePrettyXML” value=”false” />

<requestFlow> <handler type=”log” />

</requestFlow> <responseFlow>

 <handler type=”log” />


transport elements

<transport name=”http” pivot=”java:org.apache.axis.transport.http.HTTPSender” /> <transport name=”local” pivot=”java:org.apache.axis.transport.local.LocalSender” /> <transport name=”java” pivot=”” />

The axis.log will get created under the tomcat/bin directory.

In Category: General

Ravi Shankar

A Software developer and blogger who is always looking to provide technical help to the wider community.

Show 5 Comments
  • Francisco March 12, 2010, 2:33 pm

    Muchas gracias. Excelente, al fin consigo guardar el XML. Gracias por compartir tu conocimiento 😉

  • nik June 17, 2010, 5:40 pm

    it’s not working for me. after I did all those changes I get this error:

    RemoteException: java.lang.NullPointerException

    I use axis 1.2.1

  • Eric Polin May 16, 2011, 6:17 pm

    Thanks a lot!!!
    Default dir for the log file was the tomcat dir itself in my case; so, I put rather:
    name=”LogHandler.fileName” value=”logs/axis.log”
    which worked nicely

  • PEPE MUJICA March 7, 2013, 11:47 pm

    Do you know how to make the log to rotate and avoid huge files?

Leave a Comment

Get your free copies of the following tech guides by joining the Digital Answers mailing list.