我在使用 Apache CXF 框架
通过 Web 服务进行服务器与客户端通信时遇到一些问题。我想将服务器错误记录到外部文件而不是终端。服务器代码段;
server= new JaxwsNotificationBroker("Hello",..);
server.setAddress("http://localhost:" + brokerPort + "/wsn/NotificationBroker");
我尝试用这个来记录;
server.getInInterceptors().add(new LoggingInInterceptor());
server.getOutInterceptors().add(new LoggingOutInterceptor());
但它给出了错误The method getInInterceptors() is undefined for the type JaxwsNotificationBroker
。
是否有任何方法可以记录 JaxwsNotificationBroker
的错误?
谢谢
最佳答案
您可以在cxf:bus
内添加loggingInInterceptor
和logOutInterceptor
<cxf:bus>
<cxf:ininterceptors>
<ref bean="loggingInInterceptor" />
</cxf:ininterceptors>
<cxf:outinterceptors>
<ref bean="logOutInterceptor" />
</cxf:outinterceptors>
</cxf:bus>
关于java - Apache CXF 日志记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11431081/