1.8. 日志记录配置示例
以下示例演示了您可以在 Red Hat build of Quarkus 中配置日志记录的一些方法:
除 Quarkus 日志(INFO)外的控制台 DEBUG 日志记录,无颜色、缩短时间、缩短类别前缀
quarkus.log.console.format=%d{HH:mm:ss} %-5p [%c{2.}] (%t) %s%e%n quarkus.log.console.level=DEBUG quarkus.console.color=false quarkus.log.category."io.quarkus".level=INFO
quarkus.log.console.format=%d{HH:mm:ss} %-5p [%c{2.}] (%t) %s%e%n
quarkus.log.console.level=DEBUG
quarkus.console.color=false
quarkus.log.category."io.quarkus".level=INFO
注意
如果您在命令行中添加这些属性,请确保 "
被转义。例如,-Dquarkus.log.category.\"io.quarkus\".level=DEBUG
。
文件 TRACE 日志配置
注意
由于我们不会更改根日志记录器,控制台日志仅包含 INFO
或更高级别的日志。
附加到类别的命名处理程序
附加到根日志记录器的命名处理程序
configure a named file handler that sends the output to 'quarkus.log' attach the handler to the root logger
# configure a named file handler that sends the output to 'quarkus.log'
quarkus.log.handler.file.CONSOLE_MIRROR.enable=true
quarkus.log.handler.file.CONSOLE_MIRROR.path=quarkus.log
# attach the handler to the root logger
quarkus.log.handlers=CONSOLE_MIRROR