Dropwizard - 如何配置归档频率?

Dropwizard - How to configure the frequency of archiving?

我有以下配置

logging:
  level: INFO
  appenders:
    - type: file
      currentLogFilename: /var/log/myapplication.log
      threshold: ALL
      archive: true
      archivedLogFilenamePattern: /var/log/myapplication-%d.log
      archivedFileCount: 5
      timeZone: UTC
      logFormat: # TODO

我正在查看此文档 http://www.dropwizard.io/0.9.2/docs/manual/configuration.html#logging

如何设置归档频率为每周或每天?或者这是否需要在 dropwizard 框架之外完成?

Dropwizard 在内部使用 Logback 进行日志记录。 对于日志的每周轮换,您可以在您的 yaml 配置中设置以下 属性:

archivedLogFilenamePattern: /wombat/foo.%d{yyyy-ww}.log

使用 %d 标记说明符,可以包含可选的时间和日期模式。如果不存在,则假定为 yyyy-MM-dd 并且每天滚动日志。这里,yyyy-ww 表示每周频率。同样,可以使用 HH, mm 每小时或每分钟轮换一次日志,具体取决于用例。可以使用 java.text.SimpleDateFormat class.

指定的任何日期和时间模式

PS:您可以找到更多信息Logback documentation | Time Based Rolling Policy