我如何使用log4j登录xfire以获取XML SOAP中的请求和响应

时间:2015-02-16 20:53:07

标签: xml spring soap log4j xfire

大家好我有一个xfire和spring 3.0的网络服务,我需要发送到logg请求和响应xml web服务,我一直在寻找但找不到任何东西。

希望你能帮我整合log4j。

我的servlet.xml中的代码:

    <bean id="interfazXFireService"  class="org.codehaus.xfire.spring.remoting.XFireExporter">
      <property name="serviceFactory">
         <ref bean="xfire.serviceFactory" />
      </property>
      <property name="xfire">
         <ref bean="xfire" />
      </property>
      <property name="serviceBean">
         <ref bean="remoteMyServiceXfire" />
      </property>
      <property name="serviceClass">
         <value>
            com.test.xfire.service.RemoteMyServiceXfire
         </value>
      </property>
   </bean>  

1 个答案:

答案 0 :(得分:0)

我解决了问题agreando几个处理程序输入,输出和失败的情况下,我还通过添加相应的行修改了我的log4j.properties文件。

我受到以下链接的指导: http://docs.codehaus.org/display/XFIRE/Logging

保持良好和我的代码:

<bean id="LoggingHandler" class="org.codehaus.xfire.util.LoggingHandler"></bean>
    <bean id="DOMInHandler" class="org.codehaus.xfire.util.dom.DOMInHandler"></bean>
    <bean id="DOMOutHandler" class="org.codehaus.xfire.util.dom.DOMOutHandler"></bean>

    <bean id="interfazXFireService" class="org.codehaus.xfire.spring.remoting.XFireExporter">
    <property name="inHandlers">
    <list>
        <ref bean="DOMInHandler" />
        <ref bean="LoggingHandler" />
    </list>
    </property>
    <property name="outHandlers">
    <list>
        <ref bean="DOMOutHandler" />
        <ref bean="LoggingHandler" />
    </list>
    </property>
    <property name="faultHandlers">
        <list>
        <ref bean="DOMOutHandler" />
        <ref bean="LoggingHandler" />
    </list>
    </property>
    <property name="serviceFactory">
        <ref bean="xfire.serviceFactory" />
    </property>
    <property name="xfire">
        <ref bean="xfire" />
    </property>
    <property name="serviceBean">
        <ref bean="remoteMyServiceXfire" />
    </property>
    <property name="serviceClass">
        <value>
            com.test.xfire.service.RemoteMyServiceXfire
        </value>
    </property>
</bean> 

和我留下来的log4j.properties文件:

log4j.category.org.codehaus.xfire = ALL
log4j.category.org.apache.commons.httpclient = ALL
log4j.category.httpclient.wire = ALL

# A3 is set to be a ConsoleAppender.
log4j.appender.A3=org.apache.log4j.ConsoleAppender

# A3 uses PatternLayout.
log4j.appender.A3=org.apache.log4j.RollingFileAppender
log4j.appender.A3.File=/var/log/RemoteXfire.log
log4j.appender.A3.MaxFileSize=5MB
log4j.appender.A3.layout=org.apache.log4j.PatternLayout
log4j.appender.A3.layout.ConversionPattern=MIT: %-4r [%t] %-5p %c %x - %m%n