我有一个带有 soap
的 cxf
服务,并希望通过注释启用带有 pretty-print 的默认日志记录。我怎么能这样做?
@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);
}
}
在那之后,我可以在功能上使用这个类。