Reputation: 853
I'm new at logging and I've got a println
for debugging that I would like to be able to silence.
I tried Scala Logging with Logback (runnable example), but I'm surprised that I can't silence the new logger by changing the sbt log level, e.g. > warn
.
Can sbt control another logger's log levels?
Or should I be trying to use sbt's logger instead?
Upvotes: 0
Views: 63
Reputation: 1085
Logback has its own configuration file to control the logging in the application. You need a "logback.xml" to be in src/main/resources folder to configure. The below is a simple example, you could control your log at any levels , the below case will not print out debug level logs. In addtion, you can set up complexed loggings such as file based logging and more. See http://logback.qos.ch/manual/configuration.html for detail
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}: %msg%n</pattern>
</encoder>
</appender>
<root level="info">
<appender-ref ref="CONSOLE" />
</root>
</configuration>
Upvotes: 1