Reputation: 365
I've configured CXF
and now I want to use logging and configure it from xml without extra code. For this purpose, I've added this xml configuration to my 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. What am I doing wrong?
And is there any way to configure writing logs to an external file (not to console) ?
Upvotes: 0
Views: 1756
Reputation: 2991
Make the following changes and it should work for you -
Add fault interceptors to your <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:
org.apache.cxf.common.logging.Slf4jLogger
In JBoss's standalone.xml
, add the following property after <extensions>
:
<system-properties>
<property name="org.apache.cxf.logging.enabled" value="true"/>
</system-properties>`
Upvotes: 1