Hi,
Is there a way to intercept logging from the 3rd party library used by my gradle build and provide my own behavior for handling those log messages?
For example, I tried adding a StandardOutputListener to my gradle logger, but this one did not get invoked when INFO messages were logged/sent by my 3rd party library’s log4j, although these messages did show up in gradle’s console when I executed build with the “-i” flag. But they were not intercepted by this StandardOutputListener I added below.
project.logging.setLevel(LogLevel.INFO)
project.logging.addStandardOutputListener(
new StandardOutputListener() {
@Override
void onOutput(CharSequence charSequence)
{
println("Message intercepted: " + charSequence.toString())
}
}
)
As a workaround, I also tried modifying log4j.properties file inside of my 3rd party library .jar file that I import in my gradle project, but this had no effect either.
Thanks, Dmitriy.