https://kotlinlang.org logo
Title
j

Joel Armstrong

04/19/2018, 2:08 AM
Anyone have a recommendation for what I should do for logging? I looked at kotlin-logging but I couldn't figure out how to log to a file / do configuration, etc?
a

andyb

04/19/2018, 2:39 AM
Hi Joel, I just use the standard Java slf4j loggers. The log output can then be directed by defining appenders in log4j properties file, see https://stackoverflow.com/questions/20328646/org-slf4j-logger-logs-to-console-how-do-i-log-to-file#20328872
n

nfrankel

04/19/2018, 5:22 AM
as a fun exercise, i wrote slf4k https://github.com/nfrankel/slf4k it’s just a wrapper around slf4j the benefit is that it’s lazy the string expression is only evaluated if the log level matches (just as for log4j2)
:kotlin: 1
👍 2
it’s available as a package on bintray/jcenter https://bintray.com/nfrankel/maven/slf4k/
a

andyb

04/19/2018, 7:21 AM
Definitely grabbing that 🙂
🎉 1