当前位置: 首页 > 知识库问答 >
问题:

logback忽略了我的logback.xml

白腾
2023-03-14

我有一个SBT/Scala项目,该项目包含其依赖项“ch.qos.logback”%“logback-classic”%“1.0.13”,并包含一个logback.xml文件,其内容如下:

<configuration debug="true">
    <logger name="com.typesafe.sslconfig.ssl.ConfigSSLContextBuilder" level="ERROR"/>
    <logger name="com.typesafe.sslconfig.ssl.AlgorithmChecker" level="ERROR"/>

    <root level="ERROR">
        <appender class="ch.qos.logback.core.ConsoleAppender">
            <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
                <pattern>%d{ISO8601} | %-5level | %thread | %logger{1} | %m%n</pattern>
            </encoder>
        </appender>
    </root>
</configuration>

https://pastebin.com/S1qauMi9  

当我运行该程序时,得到的输出如下:

[WARN] [07/05/2017 16:01:25.782] [main] [com.typesafe.sslconfig.ssl.ConfigSSLContextBuilder] validateStore: Skipping certificate with weak key size in thawtepremiumserverca: Certificate failed: cert = "1.2.840.113549.1.9.1=#16197072656d69756d2d736572766572407468617774652e636f6d,CN=Thawte Premium Server CA,OU=Certification Services Division,O=Thawte Consulting cc,L=Cape Town,ST=Western Cape,C=ZA" failed on constraint RSA keySize < 2048, algorithm = RSA, keySize = 1024
[WARN] [07/05/2017 16:01:25.782] [main] [com.typesafe.sslconfig.ssl.ConfigSSLContextBuilder] validateStore: Skipping certificate with weak key size in thawteserverca: Certificate failed: cert = "1.2.840.113549.1.9.1=#16177365727665722d6365727473407468617774652e636f6d,CN=Thawte Server CA,OU=Certification Services Division,O=Thawte Consulting cc,L=Cape Town,ST=Western Cape,C=ZA" failed on constraint RSA keySize < 2048, algorithm = RSA, keySize = 1024 

...

16:01:25,822 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy]
16:01:25,822 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
16:01:25,822 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/Users/eswenson/Projects/Modulus/ws/modulus-shared-libraries/modules/dataset-client-cli/target/scala-2.11/dataset-client-cli-assembly-1.0.dev.jar!/logback.xml]
16:01:25,833 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@1eaf1e62 - URL [jar:file:/Users/eswenson/Projects/Modulus/ws/modulus-shared-libraries/modules/dataset-client-cli/target/scala-2.11/dataset-client-cli-assembly-1.0.dev.jar!/logback.xml] is not of type file
16:01:25,873 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.typesafe.sslconfig.ssl.ConfigSSLContextBuilder] to ERROR
16:01:25,873 |-INFO in ch.qos.logback.classic.joran.action.LoggerAction - Setting level of logger [com.typesafe.sslconfig.ssl.AlgorithmChecker] to ERROR
16:01:25,873 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to ERROR
16:01:25,907 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
16:01:25,908 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@6fd1660 - Registering current configuration as safe fallback point
[WARN] [07/05/2017 16:01:26.084] [main] [com.typesafe.sslconfig.ssl.ConfigSSLContextBuilder] validateStore: Skipping certificate with weak key size in thawtepremiumserverca: Certificate failed: cert = "1.2.840.113549.1.9.1=#16197072656d69756d2d736572766572407468617774652e636f6d,CN=Thawte Premium Server CA,OU=Certification Services Division,O=Thawte Consulting cc,L=Cape Town,ST=Western Cape,C=ZA" failed on constraint RSA keySize < 2048, algorithm = RSA, keySize = 1024
[WARN] [07/05/2017 16:01:26.085] [main] [com.typesafe.sslconfig.ssl.ConfigSSLContextBuilder] validateStore: Skipping certificate with weak key size in thawteserverca: Certificate failed: cert = "1.2.840.113549.1.9.1=#16177365727665722d6365727473407468617774652e636f6d,CN=Thawte Server CA,OU=Certification Services Division,O=Thawte Consulting cc,L=Cape Town,ST=Western Cape,C=ZA" failed on constraint RSA keySize < 2048, algorithm = RSA, keySize = 1024

Full log here:  https://pastebin.com/6Xd10TZZ

我启用了logback配置调试,这样您就可以看到logback声称将该类的loglevel设置为ERROR。但仍然记录了这些消息。

共有1个答案

白刚洁
2023-03-14

root-tag中允许的唯一标记是appender-ref,您可以通过name[1]引用先前定义的appender。将appender定义移动到配置的开头,并且仅在根中引用它。此外,如果您对日志配置的理解是这样的基础,那么您应该首先通过阅读手册[2]来改变它。

[1]https://logback.qos.ch/manual/configuration.html#rootelement

[2]https://logback.qos.ch/manual/index.html

 类似资料:
  • 我有2个Spring Boot(1.4.1-发行版)控制台应用程序使用了Logback。这两个配置文件或多或少是相同的,都位于my/src/main/resources文件夹中,名为logback-spring.xml。 这两个项目都在其pom.xml中包含了maven依赖项spring-boot-starter-logging,并获取1.1.7版本的日志。 两个POM中定义的Spring Boo

  • 附加器 和3个记录器: 记录器1 null

  • 问题内容: 这是从CruiseControl执行时得到的: 同时,从命令行启动它可以提供正确的结果。为什么要进入这个?为什么忽略了我?我该如何解决? 我不知道从CC启动when 的值是什么。我真的很想获得这些信息,但我不知道如何。CC本身是从用户开始与该用户给我(这是CentOS的5.4): 问题答案: 假设您有一台linux机器。 看一下,这是一个符号链接。查看此符号链接的目标位置(在我的情况下

  • 根据我所读到的内容,这是我执行依赖顺序所需要的全部内容。 然后我构建了所有的东西,设置了我的断点,并启动了应用程序。我希望在任何依赖bean之前到达“configData”bean中的断点。事情不是这样的。第一个断点在一个依赖bean的“init”方法中。 然后我更改了“log4j.xml”,将“debug”设置为“org.springframework”的日志级别,并重新运行测试。断点行为是相同

  • 问题内容: 有一个实体A引用(多对一)实体B,从B到A的反向(映射)引用。也有从A到C的引用,以及从C到A的反向引用。当我发布entityManager.remove(A )然后flush(),“ delete”没有发芽!但也没有例外。就像根本没有调用remove()一样。为什么会这样?如果在remove()之前,我们从反向引用B.listOfA和C.listOfA中提取A,则会按预期生成“删除”

  • 我们在java ee应用程序中使用Log4j2。我们使用一个库,其中日志是根据SLF4J编程的。在这个库中有一个类,它记录了很多我不想要的东西- 我的日志4J2。xml如下所示: 但是,BaseSerializingTranscoder仍然记录错误。如果我做一个简单的测试,并将BaseSerializingTranscoder中找到的日志代码放在测试函数中,我会看到记录器是通过org检索的。slf