This message was deleted.
# community-support
s
This message was deleted.
z
in my
BuildServce
- I need to invoke a CLI command
e
constructor or property injection instead of params, same goes for all of these types: https://docs.gradle.org/current/userguide/custom_gradle_types.html#services_for_injection
Copy code
abstract class MyBuildService @Inject constructor(
    private val execOperations: ExecOperations,
) : BuildService<MyBuildService.Params>

// or this
@get:Inject
protected abstract val execOperations: ExecOperations
❤️ 1
z
thank you!
any idea why I can’t inject a
Logger
into a
BuildService
?
e
Loggers are never injected
just use
Logger.getLogger(class)
z
DefaultTask
has a
Logger
- but AFAIK there is not one for
BuildService
. Thanks!
e
project, script, and task instances have a getLogger() method. but it's not a service that Gradle knows how to inject in general
c
Cradle Devs told me to open an issue for the same reason, but... I didn't think about using Logger.getLogger
In any case..then you don't have the custom Gradle levels, do you?
👍 1
z
Logger.getLogger
returns an
slf4j
type logger, right? I want a Gradle logger
kinda silly to not being to use the Gradle logger in a
BuildService
lol
c
As I said, I asked them, they asked for the issue but.. surprise! There is one already and it got closed.
e
org.slf4j.Logger
doesn't have Gradle-specific levels, but
org.gradle.api.Logger
does
Gradle's logging is set up such so that the loggers are all Gradle-wrapped either way, but if you use
org.gradle.api.Logger.getLogger()
then you don't have to cast it
^ that issue is not closed
c
Oh, noups, stale but removed the label without any comments cara pensativa
v
It is sufficient to modify any comment to keep it open. :-)
👌 1