CXF 3.1 wsdl2java logging with Log4j2
<p>I have generated my service using CXF 3.1 wsdl2java, so no cxf.xml.</p>

<p>I am trying to add the request and response XML for the service to my log4j2 setup. There is a lot of conflicting information due to version changes etc. My request/response xml CXF logging file is always empty.</p>

<p>This was the closest to my setup: <a href="https://stackoverflow.com/questions/24931576/how-to-log-cxf-webservice-requests-with-log4j2">How to log CXF webservice requests with log4j2?</a></p>

<p>So I have the following in my log4j2.xml </p>

<pre><code>    &lt;logger name="org.apache.cxf" additivity="false" level="info"&gt;
            &lt;AppenderRef ref="APP_LOG_FILE"/&gt;
    &lt;/logger&gt;
    &lt;logger name="org.apache.cxf.interceptor.LoggingInInterceptor" additivity="false" level="info"&gt;
        &lt;AppenderRef ref="WS_LOG_FILE" /&gt;
    &lt;/logger&gt;
    &lt;logger name="org.apache.cxf.interceptor.LoggingOutInterceptor" additivity="false" level="info"&gt;
        &lt;AppenderRef ref="WS_LOG_FILE" /&gt;
    &lt;/logger&gt;
</code></pre>

<p>Not showing the appenders, but they are there, the APP_LOG_FILE is populated but the WS_LOG_FILE appender files is always empty, while messages being exchanged.</p>

<p>I added a META-INF/cxf/org.apache.cxf.Logger file with this content</p>

<pre><code>org.apache.cxf.common.logging.Slf4jLogger
</code></pre>

<p>I also tried using the additional command line parameter when running my jar as an alternative to the cxf.Logger file:</p>

<pre><code>-Dorg.apache.cxf.Logger=org.apache.cxf.common.logging.Slf4jLogger
</code></pre>

<p>I added the additional dependency:</p>

<pre><code>&lt;dependency&gt;
    &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
    &lt;artifactId&gt;log4j-slf4j-impl&lt;/artifactId&gt;
    &lt;version&gt;2.0&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>

<p>I tried the following both with the logging interceptors (are they required or an alternative to the config in the log4j2.xml?) and without them, as shown currently commented out.</p>

<pre><code>    GetComparisonDecisionService equinitiComparisonService = new GetComparisonDecisionService();
    GetComparisonDecisionInterface comparison = equinitiComparisonService.getGetComparisonDecision();
/*
    Client client = ClientProxy.getClient(equinitiComparisonService.getPort(GetComparisonDecisionInterface.class));
    client.getInInterceptors().add(new LoggingInInterceptor());
    client.getOutInterceptors().add(new LoggingOutInterceptor());
*/
    GetComparisonDecisionCallParameter comparisonDecisionCallParameter = new GetComparisonDecisionCallParameter();
    comparisonDecisionCallParameter.setSecurityToken(token);
    comparisonDecisionCallParameter.setComparisonApplication(equinitiApp);

    GetComparisonDecisionResponseParameter eqDescn = comparison.getComparisonDecision(comparisonDecisionCallParameter);
</code></pre>

<p>I have run out of ideas at this point. The cxf documentation is very terse. </p>