问题描述
我在项目中使用slf4j-simple
.我想将slick
的日志记录级别更改为INFO.阅读 Slick的日志记录选项后和 Class SimpleLogger文档我试图向我的VM行:
I am using slf4j-simple
in my project. I would like to change logging level for slick
to INFO. After reading Logging options for Slickand Class SimpleLogger docsI have tried to add following options to my VM line:
-Dorg.slf4j.simpleLogger.defaultLogLevel=INFO
-Dlogger.scala.slick=INFO
-Dlogger.scala.slick.jdbc.JdbcBackend.statement=INFO
-Dorg.slf4j.simpleLogger.log.scala.slick=INFO
我看到了一些来自码头的INFO级别的日志,因此基本日志似乎正在运行.我还可以使用-Dorg.slf4j.simpleLogger.defaultLogLevel=TRACE
更改显示的日志级别,但是即使仅显示更多的跳船日志,也不会向我显示任何平滑的日志.
I see a few INFO level logs comming from jetty, therefore the basic logging seems to be working. I am also able to change level of logs shown by using -Dorg.slf4j.simpleLogger.defaultLogLevel=TRACE
, but even that only shows more jetty logs, no Slick logs are shown to me.
如何配置slf4j-simple
向我显示光滑的日志?
How can I configure slf4j-simple
to shown slick logs to me?
推荐答案
根据 http://www.slf4j.org/api/org/slf4j/impl/SimpleLogger.html 正确的系统属性应为
According to http://www.slf4j.org/api/org/slf4j/impl/SimpleLogger.html the correct system property should be
-Dorg.slf4j.simpleLogger.log.scala.slick=debug
代替
-Dlogger.scala.slick=INFO
作为参考,可以在 logback.xml .我们仅将debug
级别用于所有这些级别.
For reference, the list of all loggers used by Slick can be found in logback.xml. We only use the debug
level with all of them.
这篇关于使用slf4j-slick进行平滑日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!