<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
    <Appenders>
        # Console appender
        <Console name="stdout" target="SYSTEM_OUT">
            # Pattern of log message for console appender
            <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %p %m%n"/>
        </Console>

        # File appender
        <File name="fout" fileName="log4j/target/baeldung-log4j2.log" immediateFlush="false" append="false">
            # Pattern of log message for file appender
            <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %p %m%n"/>
        </File>
    </Appenders>

    <Loggers>
        # Override log level for specified package
        <Logger name="com.baeldung.log4j2" level="TRACE"/>

        <AsyncRoot level="DEBUG">
            <AppenderRef ref="stdout"/>
            <AppenderRef ref="fout"/>
        </AsyncRoot>
    </Loggers>
</Configuration>