Configure log level and logging for a custom plugin's unit tests

I have a custom plugin and some of all unit tests output DEBUG level logging for all parts of gradle system and dependencies. My SOAP tests display axis debug logging. My tests which fetch dependencies show debug level details of that.

I’d like my classes to be debug log and others to be at info. I’d like to exclude org.apache.* classes from the log for example.

I experimented with displayGranularity but haven’t seen much of a change.

test {
  testLogging {
      displayGranularity 2
      events "failed"
      exceptionFormat "short"
        debug {
      }
    }
}

Can someone direct me to docs on tuning logging when running junit unit tests via gradle? Thanks

Peter

With help from Peter N.

Logging for tests must be configured properly or we go to default unconfigured which is LOG EVERYTHING. At least, that’s my theory.

Create test/resources/logback.xml

Populate it with basic form

adjust for your use case

Below we just force all logging to info. Ideally, I want org.apache.* @ info and my classes at debug but I’ll that requires me learning logback.xml format (which comes next)

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
        <pattern>%d %5p | %t | %-55logger{55} | %m %n</pattern>
    </encoder>
</appender>
<root>
    <level value="INFO"/>
    <appender-ref ref="CONSOLE"/>
</root>