无法将 DropWizard 日志记录时区设置为与主机相同

Unable to set DropWizard Logging Time Zone same as Host

我在 DropWizard 项目上有以下日志记录配置:

logging:
  level: INFO
  appenders:
    - type: console
      threshold: INFO
      target: stdout

这似乎默认使用 UTC 时区查看生成的日志中的时间。此应用程序 运行 所在的主机处于 WET 状态,如果我将日志配置更改为:

logging:
  level: INFO
  appenders:
    - type: console
      threshold: INFO
      target: stdout
      timeZone: WET

然后日志消息与主机具有相同的时间。

是否有一种机制可以让 DW 自动将时区设置为与主机相同,或者我们是否需要指定生成日志消息的确切时区?

看来您可以 set the appender's timezone to the timezone of the host 使用:

timeZone: system