How can I change log level in JUnit tests under Eclipse?

How can I do that? The default is INFO (or maybe WARN) and I need DEBUG.

It really depends what kind of test do you have - for regular JUnit tests which do not embed OSGi framework it should be possible with one of slf4j implementations. I am not certain what’s your experience level so I will just note that slf4j stands for simple logging facade for java and it provides basic API which needs to be bound with logging backend.

If I read properly openhab core test dependencies actual slf4j backend in use is slf4j-simple. Configuration of it is based on system properties which you can pass to java executable process with -D prefix. For example -Dorg.slf4j.simpleLogger.defaultLogLevel=DEBUG set as additional arguments passed to test should result in much more verbose output.
You can also try adding temporarily something like that at the beginning of your test execution:

java.lang.System.setProperty("org.slf4j.simpleLogger.defaultLogLevel", "DEBUG");

It is not guaranteed to work as expected, however might be worth to try if you will find it difficult to configure test execution in your IDE or maven build.

For complete configuration options please check slf4j’s SimpleLogger javadoc:
http://www.slf4j.org/api/org/slf4j/impl/SimpleLogger.html

Good luck!
Łukasz

That works perfectly, thank you very much.

Was looking for this information.
Just adding the following for future reference. (I don’t know if this is the best approach, it’s working though)

import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ch.qos.logback.classic.Level;

public class LogTest {
    private final Logger logger = LoggerFactory.getLogger(LogTest.class);

    @Test
    public void testCommunication() {
        Logger root = LoggerFactory.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
        ((ch.qos.logback.classic.Logger) root).setLevel(Level.DEBUG);

        logger.trace("trace message");
        logger.debug("debug message");
        logger.warn("warn message");
    }
}