Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable CXF pretty print logging on the server side in SOAP?

I have a soap service with cxf and would like to enable the default logging with pretty print by annotations. How could I do this?

@WebService
@Features(features = "org.apache.cxf.feature.LoggingFeature") //how pretty print?
public class MySoapService {

}

It should be a annotation equivalent to the following xml config:

<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>
like image 696
membersound Avatar asked Aug 26 '14 14:08

membersound


1 Answers

I was able to fix this problem by creating a very simple class that extends LoggingFeature and set prettylogging to true:

public class PrettyLoggingFeature extends LoggingFeature{

    public PrettyLoggingFeature(){
        super.setPrettyLogging(true);
    }
}

After that, I was able to use this class on features.

like image 156
Márcio Dantas Avatar answered Oct 29 '22 17:10

Márcio Dantas