M332-PT-NGCC/tests/log4j/TestLog4j.java

33 lines
730 B
Java
Raw Permalink Normal View History

2019-09-27 00:32:16 +02:00
package log4j;
import static org.junit.jupiter.api.Assertions.*;
2019-10-08 23:54:22 +02:00
import org.apache.logging.log4j.Level;
2019-09-27 00:32:16 +02:00
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
2019-10-08 23:54:22 +02:00
import org.apache.logging.log4j.core.config.Configurator;
2019-09-27 00:32:16 +02:00
import org.junit.jupiter.api.Test;
class TestLog4j {
2019-10-08 23:54:22 +02:00
private static Logger logger = LogManager.getLogger(TestLog4j.class);
2019-09-27 00:32:16 +02:00
public static void main(String[] args) {
2019-10-08 23:54:22 +02:00
int v = 9;
if (v > 8) {
Configurator.setLevel("log4j", Level.DEBUG);
}
2019-09-27 10:35:38 +02:00
2019-09-27 00:32:16 +02:00
logger.debug("msg de debogage");
logger.info("msg d'information");
logger.warn("msg d'avertissement");
logger.error("msg d'erreur");
2019-09-27 10:35:38 +02:00
logger.fatal("msg d'erreur fatale");
2019-09-27 00:32:16 +02:00
}
2019-10-03 21:40:08 +02:00
2019-09-27 00:32:16 +02:00
}