我有一个soap
服务cxf
,并希望通过注释启用默认日志记录。我怎么能这样做?
@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>
答案 0 :(得分:5)
我能够通过创建一个非常简单的类来解决这个问题,该类扩展LoggingFeature
并将prettylogging
设置为true
:
public class PrettyLoggingFeature extends LoggingFeature{
public PrettyLoggingFeature(){
super.setPrettyLogging(true);
}
}
之后,我可以在功能上使用这个类。