The documentation for log4j2 configuration provides a nice sample XML document equivalent to the default configuration:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="error">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
What would the equivalent file look like as (valid) YAML?
❐ The YAML file
The equivalent YAML file (
log4j2.yaml
) looks like this:This file is automatically loaded (assuming that the file is in the classpath and having the required dependencies), as described in Automatic Configuration.
❐ Maven
If you are using Maven, the following dependencies are required: