Logback config is ignoring my logging level

java, logback, logging

Solution

Although it is showing `o.a.c.t.h.HttpsURLConnectionFactory` in the log message, the logger name is in fact not `o.a.c.t.h.HttpsURLConnectionFactory`. `o.a.c...` is simply an abbreviation of the full name.

I think you should use `org.apache.cxf` instead of `o.a.c` and `o.a.cxf` in your `logback.xml`

Problem

I'm getting ecessive logging in my project, and I'm having trouble supressing the logging statements I don't want. I'm using Logback which I installed by adding to my POM. ``` <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.0.13</version> </dependency> ``` My logs always start with these three lines: ``` SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. ``` Googling indicates this is Eclipse issue and not a Logback configuration issue, but I'm including it in case my Googling mislead me. Here is my logback.xml ``` <?xml version="1.0" encoding="UTF-8"?> <configuration> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <layout class="ch.qos.logback.classic.PatternLayout"> <Pattern>%d{HH:mm:ss.SSS} %-5level %logger{36} - %msg%n</Pattern> </layout> </appender> <logger name="com.my.project" level="TRACE"/> <logger name="o.a.cxf" level="INFO"/> <logger name="o.a.c" level="INFO"/> <root level="debug"> <appender-ref ref="STDOUT" /> </root> </configuration> ``` And here's an excerpt from my logs ``` [INFO] 17:41:53.095 DEBUG o.a.c.t.h.HttpsURLConnectionFactory - The SSL_DH_anon_WITH_DES_CBC_SHA cipher suite is excluded by the filter. [INFO] 17:41:53.095 DEBUG o.a.c.t.h.HttpsURLConnectionFactory - The SSL_RSA_EXPORT_WITH_RC4_40_MD5 cipher suite is included by the filter. [INFO] 17:41:53.095 DEBUG o.a.c.t.h.HttpsURLConnectionFactory - The SSL_DH_anon_EXPORT_WITH_RC4_40_MD5 cipher suite is excluded by the filter. [INFO] 17:41:53.096 DEBUG o.a.c.t.h.HttpsURLConnectionFactory - The SSL_RSA_EXPORT_WITH_DES40_CBC_SHA cipher suite is included by the filter. [INFO] 17:41:53.096 DEBUG o.a.c.t.h.HttpsURLConnectionFactory - The SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA cipher suite is included by the filter. [INFO] 17:41:53.096 DEBUG o.a.c.t.h.HttpsURLConnectionFactory - The SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA cipher suite is included by the filter. [INFO] 17:41:53.096 DEBUG o.a.c.t.h.HttpsURLConnectionFactory - The SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA cipher suite is excluded by the filter. [INFO] 17:41:53.097 DEBUG o.a.c.t.h.HttpsURLConnectionFactory - The TLS_KRB5_WITH_RC4_128_SHA cipher suite is included by the filter. [INFO] 17:41:53.103 DEBUG o.a.c.t.h.HttpsURLConnectionFactory - The TLS_KRB5_WITH_RC4_128_MD5 cipher suite is included by the filter. [INFO] 17:41:53.103 DEBUG o.a.c.t.h.HttpsURLConnectionFactory - The TLS_KRB5_WITH_3DES_EDE_CBC_SHA cipher suite is included by the filter. [INFO] 17:41:53.103 DEBUG o.a.c.t.h.HttpsURLConnectionFactory - The TLS_KRB5_WITH_3DES_EDE_CBC_MD5 cipher suite is included by the filter. [INFO] 17:41:53.104 DEBUG o.a.c.t.h.HttpsURLConnectionFactory - The TLS_KRB5_WITH_DES_CBC_SHA cipher suite is included by the filter. [INFO] 17:41:53.104 DEBUG o.a.c.t.h.HttpsURLConnectionFactory - The TLS_KRB5_WITH_DES_CBC_MD5 cipher suite is included by the filter. [INFO] 17:41:53.104 DEBUG o.a.c.t.h.HttpsURLConnectionFactory - The TLS_KRB5_EXPORT_WITH_RC4_40_SHA cipher suite is included by the filter. [INFO] 17:41:53.104 DEBUG o.a.c.t.h.HttpsURLConnectionFactory - The TLS_KRB5_EXPORT_WITH_RC4_40_MD5 cipher suite is included by the filter. ``` I've verified that my logback.xml file is being read by modifying the pattern in the appender. Those changes are being respected. But I expected setting the logger for "o.a.c" to INFO would suppress these DEBUG messages. I'm assuming the [INFO] is also coming from Eclipse, and the DEBUG later in the line is the actual logger level. Update These loggers are logged by Apache CXF. There is a dependency in my project that has stub-code generated with CXF. When I use that stub code to invoke the webservice these loggers are generated. I didn't write these logging statements, so I can only assume they are coming from CXF. Also, I don't see these loggers when I use Log4j. I'm trying to learn Logback as I've been assigned to evaluate it as a possible upgrade for the team.

Original source