how to configure kotlin-logging logger

We do not have a way to change log level from slf4j api and we need to rely on implementation

By looking at the Logger interface of slf4j, you can see that it has isLevelEnabled() for all the levels, but not a setter. Therefore, setting the level is implementation specific and it is based on the underlying logging platform you use.


From your question it looks like you use slf4j SimpleLogger as the layer behind slf4j. For SimpleLogger, you can only change the log level through properties like you've already done. See this question for more information.

System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "TRACE");

Please note that once the logger is created the log level can't be changed. If you need to dynamically change the logging level you might want to use log4j with SLF4J.


I'm using kotlin-logging in a Spring Boot application.

What worked

Run application with

-Dlogging.level.com.mydomain.myapp=DEBUG

(Replace com.mydomain.myapp with the desired package namespace or root for all.)

Alternatively you can add the property to an application properties file

logging.level.com.mydomain.myapp = DEBUG

What didn't work

  • -Dorg.slf4j.simpleLogger.defaultLogLevel=DEBUG
  • -Dorg.slf4j.simplelogger.defaultlog=DEBUG
  • --debug (as one of the program options)