[英]Apache cxf file logging
我已经配置了CXF
,现在我想使用日志记录并从 xml 配置它,而无需额外的代码。 为此,我已将此 xml 配置添加到我的appContext
:
<import resource="classpath:META-INF/cxf/cxf.xml" />
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor" id="logInInterceptor" />
<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" id="logOutInterceptor" />
<cxf:bus>
<cxf:inInterceptors>
<ref bean="logInInterceptor" />
</cxf:inInterceptors>
<cxf:outInterceptors>
<ref bean="logOutInterceptor" />
</cxf:outInterceptors>
</cxf:bus>
<jaxws:endpoint id="myServiceBean" implementor="com.mysite.webservice.myWSDLBean_Client" address="/mySearch">
</jaxws:endpoint>
但它在通话期间不记录任何内容,尽管在部署服务器时,我看到logInInterceptor
和logOutInterceptor
已映射。 我究竟做错了什么?
有没有办法将日志写入外部文件(而不是控制台)?
进行以下更改,它应该适合您 -
将故障拦截器添加到您的<cxf:bus>
:
<cxf:bus> . . . <cxf:outFaultInterceptors> <ref bean="loggingOutInterceptor"/> </cxf:outFaultInterceptors> <cxf:inFaultInterceptors> <ref bean="loggingInInterceptor"/> </cxf:inFaultInterceptors> </cxf:bus>`
在您的/META-INF/cxf
添加一个文件org.apache.cxf.Logger
,内容如下:
org.apache.cxf.common.logging.Slf4jLogger
在 JBoss 的standalone.xml
,在<extensions>
之后添加以下属性:
<system-properties> <property name="org.apache.cxf.logging.enabled" value="true"/> </system-properties>`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.