开发者

CXF server-side logging to a table

In CXF, you can enable logging using this:

<cxf:bus>
   <cxf:features>
      <cxf:logging/>
   </cxf:features>
</cxf:bus>

Source: http://cxf.apache.org/docs/configuration.html

Everything seems to go to files or console and can be configured using Log4j as well it seems.

My question is, how do you enable logging on server side so that you can intercept these raw requests and responses and store them in a table in the database along with other application specific information related to the service call.

This is all for server-side开发者_如何学编程 service implementation class.


The example you quoted was the simplest possible config to do basic logging. If you look at the example right before, you can see a slightly more expanded approach to logging interceptors:

<cxf:bus>
    <cxf:inInterceptors>
        <ref bean="logInbound"/>
    </cxf:inInterceptors>
    <cxf:outInterceptors>
        <ref bean="logOutbound"/>
    </cxf:outInterceptors>
    <cxf:inFaultInterceptors>
        <ref bean="logOutbound"/>
    </cxf:inFaultInterceptors>
</cxf:bus> 

Here, the logInbound, logOutbound and logOutbound beans are any implementation of CXF's interceptor interface. You can implement your own interceptor beans to do any type of logging you choose, including database logging.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜