Friday, January 14, 2011

et tu log4j? java.lang.classnotfoundexception: org.apache.log4j.enhancedpatternlayout

While I was setting log4j for our new project I got the following exception:


log4j:ERROR Could not instantiate class [org.apache.log4j.EnhancedPatternLayout].
java.lang.ClassNotFoundException: org.apache.log4j.EnhancedPatternLayout


I have log4j in my pom and its jar in my local repository so why EnhancedPatternLayout is missing?
This class is not in our log4j but in log4j-extras. You have to add the necessary extras jar to your pom.



log4j
apache-log4j-extras
1.0



I added the version 1.0 because version 1.1 requires log4j 1.2.16 while I'm using log4j 1.2.15.

1 comment:

  1. Nice. Almost a year later, this was exactly what I needed! Thanks for sharing :)

    ReplyDelete