具有多个appender的log4j和YAML配置

时间:2016-10-03 16:02:45

标签: java logging log4j dropwizard

我花了几天的时间想办法使用log4j使用YAML配置文件登录两个不同的文件。有可能吗?

我在属性文件和一些博客文章中遇到了类似的问题,如下所示。

我有一个像这样的配置文件:

logging:
  # The default level of all loggers. Can be OFF, ERROR, WARN, INFO, DEBUG, TRACE, or ALL.
  level: INFO
  # Logger-specific levels.
  loggers:
    # Sets the level for 'com.appraptorsors.herotemps' to DEBUG.
    com.company.project: DEBUG
  appenders:
    - type: console
      threshold: ALL
    - type: file
      threshold: ALL
      currentLogFilename: /home/assets/logs/_1.log
      archivedLogFilenamePattern: ./logs/archive-%d.log.gz
      archivedFileCount: 5
      # The timezone used to format dates. HINT: USE THE DEFAULT, UTC.
      timeZone: UTC

如何按照此接受的答案here中的说明进行配置?这正是我正在寻找的 - 由不同的处理程序调用的两个记录器。另一个参考是here

我的log4j版本是1.2.17,可以升级它。

非常感谢任何帮助。

0 个答案:

没有答案
相关问题