I am always getting:  ERROR StatusLogger Log4j2 could not find a logging 
implementation. Please add log4j-core to the classpath. Using SimpleLogger to 
log to the console...



Happens in eclipse oxygen.  Also happens in this sample program.



Works fine in 2.9.1, but not in 2.10.0



Request a JIRA be created on this issue and corrected in either 2.10.1 or 
2.11.0.



Thanks for the help!



Mark





C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue>echo Win7

Win7



C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue>echo java version

java version



C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue>java -version

java version "1.8.0_152"

Java(TM) SE Runtime Environment (build 1.8.0_152-b16) Java HotSpot(TM) 64-Bit 
Server VM (build 25.152-b16, mixed mode)



C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue>echo log4j2.properties content

log4j2.properties content



C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue>type log4j2.properties

status = info

name = SamplePropertiesConfig



appenders = console



appender.console.type = Console

appender.console.name = STDOUT

appender.console.layout.type = PatternLayout appender.console.layout.pattern = 
%d{yyyy-MM-dd HH:mm:ss} %-5p %c{3}:%L - %m%n



rootLogger.level = trace

rootLogger.appenderRefs = stdout

rootLogger.appenderRef.stdout.ref = STDOUT





C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue>echo Source Code:

Source Code:



C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue>type DoIt.java

import org.apache.logging.log4j.LogManager;

import org.apache.logging.log4j.Logger;



public class DoIt {

      public static void main(String[] args) {

            Logger logger = LogManager.getLogger();

            logger.trace("doit-main-trace");

            logger.debug("doit-main-debug");

            logger.info("doit-main-info");

            logger.warn("doit-main-warn");

            logger.error("doit-main-error");

            logger.fatal("doit-main-fatal");

      }

}

C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue>echo Compile code against 2.10 api

Compile code against 2.10 api



C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue>javac -classpath 
c:\dev\mvnRepo\org\apache\logging\log4j\log4j-api\2.10.0\log4j-api-2.10.0.jar 
DoIt.java



C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue>dir

Volume in drive C is Boot

Volume Serial Number is 8E96-A188



Directory of C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue



01/27/2018  11:03 AM    <DIR>          .

01/27/2018  11:03 AM    <DIR>          ..

01/27/2018  11:22 AM               725 DoIt.class

01/27/2018  10:49 AM               492 DoIt.java

01/27/2018  11:05 AM               369 log4j2.properties

01/27/2018  11:18 AM               917 script.bat

               4 File(s)          2,503 bytes

               2 Dir(s)  90,855,899,136 bytes free



C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue>echo run against 2.9.1 api and core 
- works

run against 2.9.1 api and core - works



C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue>java -classpath 
.;c:\dev\mvnRepo\org\apache\logging\log4j\log4j-core\2.9.1\log4j-core-2.9.1.jar;c:\dev\mvnRepo\org\apache\logging\log4j\log4j-api\2.9.1\log4j-api-2.9.1.jar
 DoIt

2018-01-27 11:22:36 TRACE DoIt:7 - doit-main-trace

2018-01-27 11:22:36 DEBUG DoIt:8 - doit-main-debug

2018-01-27 11:22:36 INFO  DoIt:9 - doit-main-info

2018-01-27 11:22:36 WARN  DoIt:10 - doit-main-warn

2018-01-27 11:22:36 ERROR DoIt:11 - doit-main-error

2018-01-27 11:22:36 FATAL DoIt:12 - doit-main-fatal



C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue>echo jars exist

jars exist



C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue>dir 
c:\dev\mvnRepo\org\apache\logging\log4j\log4j-core\2.10.0\*.jar

Volume in drive C is Boot

Volume Serial Number is 8E96-A188



Directory of c:\dev\mvnRepo\org\apache\logging\log4j\log4j-core\2.10.0



01/26/2018  10:16 PM         1,210,299 log4j-core-2.10.0-sources.jar

01/26/2018  09:03 PM         1,727,302 log4j-core-2.10.0.jar

               2 File(s)      2,937,601 bytes

               0 Dir(s)  90,855,899,136 bytes free



C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue>dir 
c:\dev\mvnRepo\org\apache\logging\log4j\log4j-api\2.10.0\*.jar

Volume in drive C is Boot

Volume Serial Number is 8E96-A188



Directory of c:\dev\mvnRepo\org\apache\logging\log4j\log4j-api\2.10.0



01/26/2018  10:16 PM           238,630 log4j-api-2.10.0-sources.jar

01/26/2018  09:03 PM           255,485 log4j-api-2.10.0.jar

               2 File(s)        494,115 bytes

               0 Dir(s)  90,855,899,136 bytes free



C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue>echo run against 2.10 api and core - 
fails

run against 2.10 api and core - fails



C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue>java -classpath 
.;c:\dev\mvnRepo\org\apache\logging\log4j\log4j-core\2.10.0\log4j-core-2.10.0.jar;c:\dev\mvnRepo\org\apache\logging\log4j\log4j-api\2.10.0\log4j-api-2.10.0.jar
 DoIt

ERROR StatusLogger Log4j2 could not find a logging implementation. Please add 
log4j-core to the classpath. Using SimpleLogger to log to the console...

ERROR DoIt doit-main-error

FATAL DoIt doit-main-fatal

C:\dev\reproducelog4j2-2.10-vs-2.9.1-issue>





Reply via email to