LightCouch忽略Log4j日志级别

时间:2018-08-11 09:54:03

标签: java couchdb log4j2

我正在使用SLF4J / Log4j2登录在Tomcat 8.5上运行的Web应用程序。尽管日志级别适用于应用程序的其余部分,但LightCouch 0.2.0始终忽略它。我注意到日志格式也与log4j2.xml中的定义不同。

catalina.out

10-Aug-2018 21:13:35.591 INFORMATION [http-nio-8080-exec-134] org.lightcouch.CouchDbClient.process > GET /somedb/some-doc-id
10-Aug-2018 21:13:35.603 INFORMATION [http-nio-8080-exec-134] org.lightcouch.CouchDbClient.process < Status: 200
21:13:35.675 [http-nio-8080-exec-134] INFO  my.package.MyClass - Some expected log statement ...

log4j2.xml

<Configuration status="WARN">
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
        </Console>
    </Appenders>
    <Loggers>
        <Logger name="my.package" level="info"/>
        <Root level="warn">
            <AppenderRef ref="Console"/>
        </Root>
    </Loggers>
</Configuration>

等级依赖性

compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.21'
compile group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.11.0'
compile group: 'org.glassfish.jersey.bundles', name: 'jaxrs-ri', version: '2.27'
compile group: 'nl.martijndwars', name: 'web-push', version: '3.1.1'
compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version: '1.60'
compile group: 'org.quartz-scheduler', name: 'quartz', version: '2.3.0'
compile group: 'org.quartz-scheduler', name: 'quartz-jobs', version: '2.3.0'
compile group: 'javax.transaction', name: 'jta', version: '1.1'
compile group: 'org.lightcouch', name: 'lightcouch', version: '0.2.0'

1 个答案:

答案 0 :(得分:0)

我不知道Log4j2无法处理Log4j开箱即用的记录。为此必须使用日志桥。添加log4j-jcl后,LightCouch记录最终“表现”。

等级依赖性

compile group: 'org.apache.logging.log4j', name: 'log4j-jcl', version: '2.11.1'