Hi folks,

I'm trying to set up request/response logging via log4j, as described here:

http://cwiki.apache.org/CXF20DOC/debugging.html

and elaborated on here:

http://www.techper.net/2008/01/30/configuring-cxf-logging-to-go-through-log4j/

However, it's not playing nice...

I have the following stanza in my cxf-servlet.xml:

        <cxf:bus>
                <cxf:features>
                        <cxf:logging />
                </cxf:features>
        </cxf:bus>

(where cxf="http://cxf.apache.org/core";)

I have a file org.apache.cxf.Logger which contains the following line:

org.apache.cxf.common.logging.Log4jLogger

This ends up at WEB-INF/classes/META-INF/cxf/org.apache.cxf.Logger
relative to the root of the web app.

And my log4j.properties looks like this:

log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.maxFileSize=10240KB
log4j.appender.file.maxBackupIndex=5
log4j.appender.file.File=/var/log/EMBRACE/enfin-war.log
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ISO8601} %5p [%t]
%c{1}:%L - %m%n
log4j.rootLogger=info, file
log4j.logger.org.apache.cxf.interceptor.LoggingInInterceptor=info, file
log4j.logger.org.apache.cxf.interceptor.LoggingOutInterceptor=info, file

I know CXF is using log4j because I get messages in enfin-war.log like:

2009-06-23 13:12:47,565  INFO [http-8080-1] ServerImpl:91 - Setting
the server's publish address to be /EnfinFuncNetService

But there's no sign of the SOAP messages.

I tried replacing the bus feature in CXF's config with explicit bean
definitions:

    <bean id="logInbound"
class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
    <bean id="logOutbound"
class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
        
    <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
        <property name="inInterceptors">
            <list>
                <ref bean="logInbound"/>
            </list>
        </property>
        <property name="outInterceptors">
            <list>
                <ref bean="logOutbound"/>
            </list>
        </property>
        <property name="outFaultInterceptors">
            <list>
                <ref bean="logOutbound"/>
            </list>
        </property>
    </bean>

Now I get the following acknowledgement in enfin-war.log that this is
being read OK:

2009-06-23 13:26:54,390  INFO [http-8080-1]
DefaultListableBeanFactory:414 - Pre-instantiating singletons in
org.springframework.beans.factory.support.defaultlistablebeanfact...@52ae76:
defining beans [EnfinFuncNetService,logInbound,logOutbound,cxf];
parent: 
org.springframework.beans.factory.support.defaultlistablebeanfact...@22c5e6

... but still no message logging. Any ideas?

Thanks yet again in advance,

Andrew.

-- 
:: http://biotext.org.uk/ ::

Reply via email to