```java
import org.apache.logging.log4j.core.config.Configurator;
@Before
public void setUp() {
Configurator.setRootLevel(Level.DEBUG);
}
```
[stackoverflow](https://stackoverflow.com/questions/23434252/programmatically-change-log-level-in-log4j2)
The accepted answer by @slaadvak did not work for me for Log4j2 2.8.2. The following did.
To change the log Level universally use:
```java
Configurator.setAllLevels(LogManager.getRootLogger().getName(), level);
```
To change the log Level for only the current class, use:
```java
Configurator.setLevel(LogManager.getLogger(CallingClass.class).getName(), level);
```