我有一个带有 cxf
的 soap
服务,我想通过注释启用默认日志记录。我怎么能这样做?
@WebService
@Features(features = "org.apache.cxf.feature.LoggingFeature") //how pretty print?
public class MySoapService {
}
它应该是一个注解,相当于下面的xml配置:
<jaxws:endpoint implementor="de.MySoapService" address="/MySoapService">
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature">
<property name="prettyLogging" value="true"/>
</bean>
</jaxws:features>
</jaxws:endpoint>
最佳答案
我能够通过创建一个非常简单的类来解决这个问题,该类扩展 LoggingFeature
并将 prettylogging
设置为 true
:
public class PrettyLoggingFeature extends LoggingFeature{
public PrettyLoggingFeature(){
super.setPrettyLogging(true);
}
}
之后,我就可以在功能上使用这个类了。
关于java - 如何在 SOAP 的服务器端启用 CXF pretty-print 日志记录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25507761/