0

我将 Apache CXF 3.1 用于 SOAP 客户端。我打算使用 log4j2 将所有传入和传出的 SOAP 消息记录到日志文件中。这是我目前的设置:

SOAP 客户端使用JaxWsProxyFactoryBean.

org.apache.cxf.Logger在目录中放置了一个文件src/META-INF/cxf,内容为org.apache.cxf.common.logging.Log4jLogger

cxf.xml:

<bean id="loggingFeature" class="org.apache.cxf.feature.LoggingFeature">
    <property name="prettyLogging" value="true" />
</bean>
<cxf:bus>
    <cxf:features>
        <ref bean="loggingFeature" />
    </cxf:features>
</cxf:bus>

log4j2.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
    <Appenders>
        <Console name="CONSOLE" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level [%t] %logger{36} - %msg%n"/>
        </Console>
        <File name="LOG_FILE" fileName="all.log" immediateFlush="false" append="true">
            <PatternLayout pattern="%d{HH:mm:ss.SSS} %-5level [%t] %logger{36} - %msg%n"/>
        </File>
    </Appenders>
    <Loggers>
        <Root level="DEBUG">
            <AppenderRef ref="CONSOLE"/>
            <AppenderRef ref="LOG_FILE"/>
        </Root>
        <Logger name="org.apache.cxf" level="INFO">
            <AppenderRef ref="LOG_FILE" />
        </Logger>
    </Loggers>
</Configuration>

但是我在文件中看不到任何 CXF 日志消息。我在这里想念什么?

4

0 回答 0