The easiest way I've found is to create a couple of handlers and set
them int eh request and response flows. These handlers will have a
chance to operate on the message context as it comes in and out of
axis. At this time you can perform the logging that you require.
I split the req, the resp, and faults into different log files and
have different handlers for each scenario. I have something like the
following in my globalConfiguration element in the wsdd:
<requestFlow>
<handler type="java:foo.bar.RequestLogHandler" />
<handler type="java:foo.bar.FaultLogHandler" />
</requestFlow>
<responseFlow>
<handler type="java:foo.bar.ResponseLogHandler" />
</responseFlow>
Hope that helps.
On 3/3/06, San D <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
> Is there a way to log the Axis request and response SOAP messages
> using log4j.
>
> I tried with the following.It was creating the axis.log file, but no
> messages in it?
> where am i doing wrong?
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
> <log4j:configuration
> xmlns:log4j="http://jakarta.apache.org/log4j/">
>
> <appender name="FILE_ERROR" class="org.apache.log4j.FileAppender ">
> <param name="File" value="d:/Log/ErrorLog.log"/>
> <param name="Append" value="false"/>
> <param name="Threshold" value="ERROR"/>
> <!-- Rollover at midnight each day -->
> <layout class="org.apache.log4j.PatternLayout">
> <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
> </layout>
> </appender>
>
> <appender name="FILE_INFO" class="org.apache.log4j.FileAppender">
> <param name="File" value="d:/Log/AuditLog.log"/>
> <param name="Append" value="false"/>
> <param name="Threshold" value="INFO"/>
> <!-- Rollover at midnight each day -->
> <layout class="org.apache.log4j.PatternLayout">
> <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
> </layout>
> </appender>
>
> <appender name="FILE_DEBUG" class="org.apache.log4j.FileAppender">
> <param name="File" value="d:/Log/axis.log"/>
> <param name="Append" value="false"/>
> <param name="Threshold" value="DEBUG"/>
> <!-- Rollover at midnight each day -->
> <layout class="org.apache.log4j.PatternLayout">
> <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
> </layout>
> </appender>
>
> <category name="log4j.logger.org.apache.axis.SOAPPart"
> additivity="false">
> <priority value="DEBUG"/>
> <appender-ref ref="FILE_DEBUG"/>
> </category>
> <root>
> <appender-ref ref="FILE_ERROR"/>
> <appender-ref ref="FILE_INFO"/>
>
> </root>
> </log4j:configuration>
>
> Thanks
> SanDi