I want to use the new Log4J 2 - Java Logging Framework. Everything work fine, but I tried since a hour to load a custom configuration file to configure the logging (like log level).
This is my log4j2.xml:
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="OFF">
<appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</appenders>
<loggers>
<root level="error">
<appender-ref ref="Console"/>
</root>
</loggers>
</configuration>
I tried the following, but nothing works:
- Move the log4j2.xml file so it's located in the default package.
- Move the log4j2.xml file anywhere in the project
- Name the log4j2.xml file as "log4j.xml"
- Create a folder in your project, place your log4j2.xml file there and add that folder to your runtime classpath
Since the official website can't help me, I hope you can help me get Log4j 2 working with my configuration file.