java.lang.ClassNotFoundException: org.apache.log4j.FileAppender

Hopefully this will stop someone from wasting a day of their life…
If you pass in the following when you start your Java application:

java -Dlog4j.configuration=file:///some/path/

And that file contains a class that is not on the class path

log4j.rootLogger=error, myAppender

Then due to the log4j static initialisers you will not see an error for the class in question but instead:

Caused by: java.lang.ClassNotFoundException: org.apache.log4j.FileAppender
at Method)
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(

Unfortunately for me this was caused by a transitive dependency changing in Maven. Damn you Maven/Log4J

Leave a Reply

Your email address will not be published. Required fields are marked *