IntelliJ: How to set log levels for tests
Asked Answered
P

1

20

I have a problem with test console output in IntelliJ 2016. When I run JUnit tests via IntelliJ, the console window is flooded with enormous amounts of log lines, for example

DEBUG reactor.ipc ....
DEBUG io.netty.buffer.ByteBufUtil ....

It's a simple Spring-Boot application which uses the default logging - I think it's slf4j. I tried setting

logging.level.reactor.ipc=WARN

in my src/main/resources/application.properties and also setting

-Dlogging.level.root=WARN on the RunConfig's VM arguments, but neither has any effect on the log output. What is the correct place to configure logging verbosity when executing Tests from Intellij?

Patentee answered 17/12, 2017 at 21:6 Comment(0)
H
21

You can fill up file named logback.xml in src/test/resources with sample content like:

<?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="TRACE"/>
        <appender-ref ref="CONSOLE"/>
    </root>
</configuration>

to have TRACE logging level. You can change this log level to meet your needs.

Hamartia answered 19/4, 2018 at 15:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.