Gradle 5.3.1
Java OpenJDK 12 ea
Ubuntu 18.04
IntelliJ IDEA Community 2019
I’m working on my first plugin. I’m using the java-gradle-plugin plugin, TestKit and the Toolkit API.
I’m writing JUnit tests. I want to log debug and info messages from my Java classes and unit tests.
I have been trying for hours to configure Gradle to use either logback or log4j as my project’s SLF4J implementation. No matter what I’ve done, Gradle ignores it and insists on using its own internal SLF4J implementation.
That internal API class looks like it is hardcoded to effectively ignore any user-specified log level.
I’ve scoured this forum, the Gradle User Guide and Javadoc, StackOverflow, you name it. Though it’s alluded me for hours at this point, there’s gotta be some kinda way to override Gradle’s internal SLF4J implementation and make it use one of my own choosing. Isn’t there? If anybody knows how, please share? Please?
This is only a few of the many things I’ve tried to no avail:
- Choosing a log level
org.gradle.logging.level=debug
in gradle.propertiestest { gradle.startParameter.setLogLevel LogLevel.INFO }
in build gradletest { systemProperty "log4J.configuration", "~/.../logging.properties" }
test { systemProperty 'logback.configurationFile', '~/.../logback.xml' }
No matter what I’ve tried, I can’t get Gradle to use my specified logging implementation in neither the IDE nor on the command line. Please help?
Thanks.