Unrelated to Kotlin itself so maybe OT, but I'm tr...
# gradle
e
Unrelated to Kotlin itself so maybe OT, but I'm trying to integrate logging into a custom Gradle Plugin and it is proving to be difficult. I can get a logger using the
LoggerFactory
, but when executing a task, the output I see in the console is SLF4J complaining it can't find an implementation (e.g., SLF4J-Simple). Is there a plugin I can look at to understand how to properly setup logging?
v
You are right, it is off-topic. 🙂 But Gradle should catch all the major logging frameworks, so unless you need a Gradle specific log level just using SLF4J for example should usually be fine.
But maybe you use a bad version of it. The mechanism of how to catch it changed and maybe Gradle does only support one not both, I don't know.
But within a task you can also just get a logger from
logging
or what it was
e
Thanks! When implementing a custom plugin project (like, a standalone project), should I explicitly require an
implementation
of SLF4J?
I didn't see anything on the docs. They just tell you to use
LoggerFactory
.
Ah, a maybe important detail: the logging is done inside of a spawned worker (through the worker API)
v
Ah, so not in a task, then yes, just using SLF4J should work as intended afair.
Either as
implementation
or maybe better as
compileOnly
as it should be provided by the runtime already.
gratitude thank you 1