Configure LogLevel in Intellji Junit Run config in gradle project?

Does anyone know how to set up loglevel when intellij runs junit test from gradle? It seems to go into debugging for everyone and I don't see a place to configure it. The debug output is too verbose for me.




source to share

3 answers

Registration for tests must be configured correctly or we are going to the default, which is LOG ALL. At least that's my theory.

  • Create test /resources/logback.xml
  • Fill it out with the basic form
  • customize for use.

Below we just force everything to log information. Ideally, I want org.apache. * @Info and my classes when debugging, but I need me to learn the logback.xml format (next)

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




You need to set up the logging frameworks (logs) used by the code under test, eg. by placing the config file in src/test/resources

. How exactly this is done depends on the logging structure used.

PS: Unless it's about Android Studio, Gradle is not involved when running a unit test from IntelliJ.



Configure log4j path in VM option



In this case, the logger will be available for all test classes. I have not tested with Gradle but configured in maven and in my test config.



All Articles