slogging icon indicating copy to clipboard operation
slogging copied to clipboard

Provide a way to set the default logger via configuration or jvm args

Open gavares opened this issue 7 years ago • 1 comments

The default logger defaults to NullLogger right now. We have backend code that uses slf4j and need a simple way to configure the SLF4JLoggerFactory backend when running in the JVM. This isn't as simple as putting a configuration point in a single place where our application starts. There are numerous other scenarios where we may not go through that entry point but still need our backend code to use the SLF4JLoggerFactory (unit tests, integ tests, console, dev main vs prod main, etc.)

We'd like to configure the slogging backend in a manner similar to what is done to configure Akka to use the slf4j logging backend which is to put an entry in our application.conf like:

slogging.backend = "slogging.SLF4JLoggerFactory"

Unfortunately that would mean that your slogging core would have to take a dependency on TypesafeConfig which probably isn't doable.

An alternative is to allow jvm args: -Dslogging.backend=slogging.SLF4JLoggerFactory

gavares avatar Mar 20 '18 17:03 gavares

I've planned for some time to add HOCON-based configuration (see #26); the prequisite for that is to have pure-Scala HOCON implementation as a drop-in for JS and Native. Since there are now some options available, I can give it a try.

jokade avatar Mar 30 '18 10:03 jokade