$ java -Dlog4j.configuration=file:///path/to/your/log4j2.xml -jar /path/to/your/jar_file.jar
Written to the console, you get
ERROR
Stuffs I check to verify logging,
mvn dependency:tree | grep log ## ./gradlew dependencies | grep log
[INFO] +- com.prayagupd:log-service:jar:1.0:compile
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.6.2:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.6.2:compile
[INFO] | \- commons-logging:commons-logging:jar:1.1.1:compile
val logConfig: PropertiesConfiguration = new PropertiesConfiguration("application.properties")
System.setProperty("log4j.configurationFile", logConfig.getString("log4j.config.file"))
println("log4j.configurationFile :: " + System.getProperty("log4j.configurationFile"))
or
Configurator.initialize(null, logConfig.getString("log4j.config.file"));
Also if auto detection is happening make sure the file name is log4j2.* not log4j.*
com.fasterxml.jackson.core
jackson-databind
2.4.0
This might throw an exception if can not find the json parser
[Fatal Error] log4j2.json:1:1: Content is not allowed in prolog.