• log4j


    在 apache 官方提供的 log4j 文档中,指明了配置文件的加载顺序

    1. Log4j will inspect the "log4j.configurationFile" system property and, if set, will attempt to load the configuration using the ConfigurationFactory that matches the file extension.
    2. If no system property is set the properties ConfigurationFactory will look for log4j2-test.properties in the classpath.
    3. If no such file is found the YAML ConfigurationFactory will look for log4j2-test.yaml or log4j2-test.yml in the classpath.
    4. If no such file is found the JSON ConfigurationFactory will look for log4j2-test.json or log4j2-test.jsn in the classpath.
    5. If no such file is found the XML ConfigurationFactory will look for log4j2-test.xml in the classpath.
    6. If a test file cannot be located the properties ConfigurationFactory will look for log4j2.properties on the classpath.
    7. If a properties file cannot be located the YAML ConfigurationFactory will look for log4j2.yaml or log4j2.yml on the classpath.
    8. If a YAML file cannot be located the JSON ConfigurationFactory will look for log4j2.json or log4j2.jsn on the classpath.
    9. If a JSON file cannot be located the XML ConfigurationFactory will try to locate log4j2.xml on the classpath.
    10. If no configuration file could be located the DefaultConfiguration will be used. This will cause logging output to go to the console.
    • 当系统输出信息

      ERROR StatusLogger No Log4j 2 configuration file found.
      

      可能你的工程缺少了 log4j2 名称的配置文件。

    • 当系统输出信息

      log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
      log4j:WARN Please initialize the log4j system properly.
      log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

      可能你的工程缺少了 log4j 名称的配置文件。

    关于 log4j 的一些疑问可以在这里查看。

    学习文章

    apche的log4j.properties和log4j2.xml的配置和使用

  • 相关阅读:
    Scrapy爬虫框架的安装和使用
    pyspider爬虫框架的安装和使用
    Pyquery解析库的安装和使用
    Beautiful Soup解析库的安装和使用
    lxml解析库的安装和使用
    PhantomJS的安装和使用
    GeckoDriver的安装和使用
    用其他主机docker login登录Harbor仓库报错
    强制删除 Terminating 状态的pod
    YUM安装软件提示[Errno 14] curl#6
  • 原文地址:https://www.cnblogs.com/dins/p/log4j.html
Copyright © 2020-2023  润新知