I'm in the process of migrating a Maven multi-modules JavaEE project from Log4J 1.2.17 to Log4J 2.19.0. I successfully changed the different pom.xml and the code, I changed the log4j.xml for an updated log4j2.xml, I also added the exclusions to other dependecies (like docx4j) in order to avoid them to import log4J 1 again. Finally, I deleted the log4j.dtd file we were validating the log4j.xml again. There is no visible reference to Log4J 1 left in the project.
But when I start my Tomcat server, I get the following logs:
log4j:WARN Continuable parsing error 2 and column 31
log4j:WARN L'élément racine de document "Configuration" doit correspondre à la racine DOCTYPE "null".
log4j:WARN Continuable parsing error 2 and column 31
log4j:WARN Le document nest pas valide : aucune grammaire détectée.
log4j:ERROR DOM element is - not a <log4j:configuration> element.
log4j:configuration
is a log4j 1 configuration tag. I have no idea which part of the application is still looking for the log4j.xml. Any ideas?
I also searched in the Tomcat configuration, and even made a research on my entire disks looking for those logs, to no avail.
I found the cause of the problem. It was in the web.xml:
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:log4j.xml</param-value>
</context-param>
<context-param>
<param-name>log4jExposeWebAppRoot</param-name>
<param-value>false</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
Those lines were actually useless and I removed them, which solved the issue.