I'm createing a Play 2.1 app, in which I have decided to use Slick for database interaction.
However I can't find documentation about how to configure/enable logging for Slick.
Anyone knows this?
相关问题
- Unusual use of the new keyword
- Get Runtime Type picked by implicit evidence
- What's the point of nonfinal singleton objects
- I want to trace logs using a Macro multi parameter
- PlayFramework: how to transform each element of a
相关文章
- Gatling拓展插件开发,check(bodyString.saveAs("key"))怎么实现
- how do I log requests and responses for debugging
- RDF libraries for Scala [closed]
- Why is my Dispatching on Actors scaled down in Akk
- How do you run cucumber with Scala 2.11 and sbt 0.
- how to set H2 primary key id to auto_increment?
- GRPC: make high-throughput client in Java/Scala
- Android Studio doesn't display logs by package
Slick doesn't do much of any logging above
DEBUG
level. Inapplication.conf
if you add the line:you're going to get deluged with information from the query compiler.
You're probably just interested in the session information (Connection pool management, query strings, etc). In which case, just add
to your Play application's
application.conf
Slick seems to use slf4j for its logging. So you might want to add a dependency on something like
slf4j-simple
to your project and set the desired log level for the Slick classes.I've tried to integrate the logback.xml with the Slick logger but it doesn't work.
Modifing logger.xml (get it the latest version from GitHub based on your version) and adding the slick logger, instead, works.
In my case I had to add
<logger name="slick" level="INFO"/>
to mylog4j2.xml
file. I'm using Slick 3.0.3 with Spray 1.3.3 and Log4j 2.1I'm not using Play at the moment, but configure it as you would use logback. This is a nice description for setting up Play logging.
One option is to add
to application.conf, as per Play manual. The other, if you have a custom logback.xml, is to add there the following line:
For slick 3.1.0, paste this in
logback.xml
in yourresources
directory: