Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR StatusLogger Reconfiguration failed: No configuration found for '73d16e93' at 'null' in 'null'

Tags:

java

xml

log4j2

I am using log4j2 the jar files are following: log4j-api-2.14.0.jar log4j-core-2.14.0.jar log4j-slf4j-impl-2.14.0.jar

Executing the following line: LogManager.getLogger("com.foo.Bar1");

using the following VM argument: -Dlog4j.configuration=test1.xml

The config file test1.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
    <Appenders>
        <Console name="Console1" target="SYSTEM_OUT">
            <PatternLayout
                pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
        </Console>
        <File name="MyFile" fileName="test1.txt">
            <PatternLayout>
                <Pattern>%d %p %c{1.} [%t] %m%n</Pattern>
            </PatternLayout>
        </File>
    </Appenders>
    <Loggers>
        <Logger name="com.foo.Bar1" level="trace">
            <AppenderRef ref="Console1" />
            <AppenderRef ref="MyFile" />
        </Logger>
    </Loggers>
</Configuration>

the following error occurs when the java file started ERROR StatusLogger Reconfiguration failed: No configuration found for '73d16e93' at 'null' in 'null'

i understand "-Dlog4j.configuration=test1.xml" is wrong. "-Dlog4j.configurationFile=test1.xml" is correct. but i do not understand why the error appears when "-Dlog4j.configuration=test1.xml" is used.

Why the error occurs when -Dlog4j.configuration=test1.xml is used.

like image 385
John F Kanagawa Avatar asked Mar 09 '21 10:03

John F Kanagawa


1 Answers

This is because the log4j.configuration expects the file to be in the classpath, while log4j.configurationFile expects it as a file path.

If you add -Dlog4j2.debug=true to the VM arguments, you can see which file it is trying to load and will print its path. That way, you will have an indication of why the error is happening.

like image 167
naimdjon Avatar answered Nov 01 '22 08:11

naimdjon