[Solved] ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.

ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.

Error: the status logger did not find the log4j2 configuration file and will use the default configuration: log errors only to the console.

Reason: the jar package of log4j2 is log4j2 provided by the hibernate 5 framework. Even if you import a third-party log package in SSH, the system will still call log4j2. The default configuration file is log4j2.xml

Solution: add profile log4j2.xml

<?xml version="1.0" encoding="UTF-8"?>

<Configuration status="warn">
    <Appenders>
        <Console name="Console" target="SYSTEM_OUT">
            <PatternLayout pattern="%m%n" />
        </Console>
    </Appenders>
    <Loggers>
        <Root level="INFO">
            <AppenderRef ref="Console" />
        </Root>
    </Loggers>
</Configuration>

 

After configuring log4j2, hibernate will output clearer information to the console. When it is set to status = “warn”, you will see various detailed internal outputs of log4j2.

Log4j2.xml can be placed anywhere. As long as you finally put it in the classpath, create a new resources directory in the above project to place log4j2.xml. If you try to run without adding the classpath, an error will be reported.

New hibernate internal log information on the console:

08:01:59,522 INFO C3P0Registry:216 – Initializing c3p0-0.9.2.1 [built 20-March-2013 10:47:27 +0000; debug?true; trace: 10]
HHH000412: Hibernate Core {5.0.7.Final}
HHH000206: hibernate.properties not found
HHH000021: Bytecode provider name : javassist
HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
08:02:00,084 INFO AbstractPoolBackedDataSource:522 – Initializing c3p0 pool… com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts

Similar Posts: