[英]Apache cxf file logging
I've configured CXF
and now I want to use logging and configure it from xml without extra code.我已经配置了CXF
,现在我想使用日志记录并从 xml 配置它,而无需额外的代码。 For this purpose, I've added this xml configuration to my appContext
:为此,我已将此 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>
but it doesn't log anything during call, though when there is server deployment, I see that logInInterceptor
and logOutInterceptor
are mapped.但它在通话期间不记录任何内容,尽管在部署服务器时,我看到logInInterceptor
和logOutInterceptor
已映射。 What am I doing wrong?我究竟做错了什么?
And is there any way to configure writing logs to an external file (not to console) ?有没有办法将日志写入外部文件(而不是控制台)?
Make the following changes and it should work for you -进行以下更改,它应该适合您 -
Add fault interceptors to your <cxf:bus>
:将故障拦截器添加到您的<cxf:bus>
:
<cxf:bus> . . . <cxf:outFaultInterceptors> <ref bean="loggingOutInterceptor"/> </cxf:outFaultInterceptors> <cxf:inFaultInterceptors> <ref bean="loggingInInterceptor"/> </cxf:inFaultInterceptors> </cxf:bus>`
Add a file org.apache.cxf.Logger
in your /META-INF/cxf
with contents:在您的/META-INF/cxf
添加一个文件org.apache.cxf.Logger
,内容如下:
org.apache.cxf.common.logging.Slf4jLogger
In JBoss's standalone.xml
, add the following property after <extensions>
:在 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.