Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Logback配置忽略我的日志记录级别_Java_Logging_Logback - Fatal编程技术网

Java Logback配置忽略我的日志记录级别

Java Logback配置忽略我的日志记录级别,java,logging,logback,Java,Logging,Logback,我在我的项目中得到了接收日志记录,并且我在抑制我不想要的日志记录语句时遇到了问题 我使用的是通过添加到POM中安装的Logback <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> <version>1.0.13</version> </dependency&

我在我的项目中得到了接收日志记录,并且我在抑制我不想要的日志记录语句时遇到了问题

我使用的是通过添加到POM中安装的Logback

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>1.0.13</version>
</dependency>
谷歌搜索表明这是Eclipse问题,而不是Logback配置问题,但我将其包括在内,以防谷歌搜索误导我

这是我的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>
我已经通过修改appender中的模式来验证是否正在读取logback.xml文件。这些变化正在得到尊重。但我希望将“o.a.c”的记录器设置为INFO会抑制这些调试消息。我假设[INFO]也来自Eclipse,后面的调试是实际的记录器级别

更新 这些记录器由Apache CXF记录。我的项目中有一个依赖项,它使用CXF生成存根代码。当我使用该存根代码调用Web服务时,会生成这些记录器。我没有写这些日志语句,所以我只能假设它们来自CXF


另外,当我使用Log4j时,我没有看到这些记录器。我正在尝试学习Logback,因为我被指派评估它是否是团队的可能升级。

尽管它在日志消息中显示
o.a.c.t.h.HttpsURLConnectionFactory
,但记录器名称实际上不是
o.a.c.t.h.HttpsURLConnectionFactory
o.a.c.
只是全名的缩写


我认为您应该在
logback.xml

中使用
org.apache.cxf
而不是
o.a.c
o.a.cxf
而不是
o.a.c.t.h.HttpsURLConnectionFactory
,虽然日志消息中显示的是
o.a.c.t.h.HttpsURLConnectionFactory
o.a.c.
只是全名的缩写


我认为您应该使用
org.apache.cxf
而不是
o.a.c
o.a.cxf
来记录何时/何地?你是如何启动你的项目的?最值得注意的是,这是一个众所周知的m2e问题,JUnit最常出现,并且计划在Luna中进行修复。我已经更新了该问题,以包含该信息。但是,如果XML配置文件设置正确,那么日志语句在何处/如何创建真的很重要吗?我的印象是,如果我为一个记录器设置日志记录级别,不管它被调用到哪里,它都应该被抑制?你是如何启动你的项目的?最值得注意的是,这是一个众所周知的m2e问题,JUnit最常出现,并且计划在Luna中进行修复。我已经更新了该问题,以包含该信息。但是,如果XML配置文件设置正确,那么日志语句在何处/如何创建真的很重要吗?我的印象是,如果我为一个记录器设置日志记录级别,不管它在哪里被调用,它都应该被抑制!我们有一些大型复杂的项目,我可能不知道是什么导致了伐木工人。您知道关闭缩写的方法吗?在您的模式中,您使用的是
%logger{36}
。只需使用
%logger
,而不是使用它!我们有一些大型复杂的项目,我可能不知道是什么导致了伐木工人。您知道关闭缩写的方法吗?在您的模式中,您使用的是
%logger{36}
。只需使用
%logger
<?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.