Я получаю чрезмерную регистрацию в моем проекте, и у меня возникают проблемы с подавлением заявлений о регистрации, которые я не хочу.
Я использую Logback, который я установил, добавив в свой POM.
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.13</version>
</dependency>
Мои журналы всегда начинаются с этих трех строк:
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 указывает, что это проблема Eclipse, а не проблема с конфигурацией журнала, но я включаю ее в случае, если мой Googling вводит меня в заблуждение.
Вот мой 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>
И вот выдержка из моих журналов
[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.
Я проверил, что мой файл logback.xml считывается путем изменения шаблона в приложении. Эти изменения соблюдаются. Но я ожидал, что установка регистратора для "oac" в INFO будет подавлять эти сообщения DEBUG. Я предполагаю, что [INFO] также поступает из Eclipse, а DEBUG позже в строке - это фактический уровень регистратора.
Эти регистраторы регистрируются Apache CXF. В моем проекте есть зависимость, которая имеет код-заглушку, сгенерированный с помощью CXF. Когда я использую этот код заглушки для вызова веб-службы, эти регистраторы генерируются. Я не писал эти инструкции для ведения журнала, поэтому могу только предположить, что они происходят из CXF.
Кроме того, я не вижу этих регистраторов, когда я использую Log4j. Я пытаюсь изучить Logback, поскольку мне назначено его оценивать как возможное обновление для команды.
Хотя в сообщении журнала отображается oacthHttpsURLConnectionFactory
, имя регистратора фактически не является oacthHttpsURLConnectionFactory
. oac..
является просто аббревиатурой от полного имени.
Я думаю, вы должны использовать org.apache.cxf
вместо oac
и oacxf
в вашем logback.xml
%logger{36}
. Просто используйте %logger
вместо