You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by San D <sa...@gmail.com> on 2006/03/03 17:05:21 UTC

Logging Axis Soap messages

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

Re: Logging Axis Soap messages

Posted by San D <sa...@gmail.com>.
Thanks todd,
 i do not have have the wsdd in my application.I just developed a client for
a web service provider.
I generated all the stubs using the wsdl2java,other than those classes i
donot have any configuration files.


On 3/3/06, Todd Orr <to...@gmail.com> wrote:
>
> 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 <sa...@gmail.com> 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
>

Re: Logging Axis Soap messages

Posted by Todd Orr <to...@gmail.com>.
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 <sa...@gmail.com> 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