【发布时间】:2020-09-28 11:31:11
【问题描述】:
该问题类似于 - How to configure log4j to log different log levels to different files for the same logger 下所述的问题。我可以在这里找到的现有问题主要是处理 logback 和 log4j 配置。专门在 Dropwizard 配置中寻找解决此问题的方法。
已尝试通过 Internet 环顾四周,似乎 LevelMatchFilter 可能适合使用,但无法弄清楚 Dropwizard 周围的文档。
我目前拥有的是
logging:
level: INFO
appenders:
- type: file
threshold: INFO
logFormat: '%date{dd-MM-yyyy HH:mm:ss.SSS} %X{X-Request-Id} [%thread] %-5level %logger{36} - %msg%n'
currentLogFilename: .../info.log
archivedLogFilenamePattern: .../info-%i.log.gz
archivedFileCount: 2
timeZone: IST
maxFileSize: 100MB
- type: file
threshold: WARN
currentLogFilename: .../warn.log
archivedLogFilenamePattern: .../warn-%i.log.gz
... other attributes
- type: file
threshold: ERROR
...similar attributes for error logs
但这会导致log.error 成为三个文件的一部分,我打算执行的是确保它只是error.log 文件的一部分并与其他文件相关。
【问题讨论】:
标签: logging dropwizard