How to use log4j in a war configured with PropertyConfigurator in JBoss EAP 5

Solution Verified - Updated -

Issue

  • Whenever I am at a customer site and they are looking to migrate from a competitive app server they inevitably have log4j.jar in the lib directory of the WEB-INF folder of their web application. I was hoping with the 3-4 years of effort into EAP 5 this long standing issue would be corrected, but with the attached war file I am still seeing errors like this

Error message from EAP 5.0 Beta 2:

ERROR [STDERR] log4j:ERROR A "org.jboss.logging.appender.FileAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
ERROR [STDERR] log4j:ERROR The class "org.apache.log4j.Appender" was loaded by
ERROR [STDERR] log4j:ERROR [BaseClassLoader@6f531a15{vfsfile:/Users/jimtyrrell/Servers/jboss-eap-5.0/jboss-as/server/default/deploy/TestApplication.war/}] whereas object of type
ERROR [STDERR] log4j:ERROR "org.jboss.logging.appender.FileAppender" was loaded by
  • Links to advice that does not appear to work:

http://www.jboss.org/feeds/post/how_do_i_use_my_own_log4j_properties_or_xml_file_in_jboss
This page implies to me that the lib directory is off of the root of *.war/lib and that is not right to me as I can browse to a jsp in the lib directory. Also this config file for a war does not work. The above advice is on several web sites, and it does not appear to work this not good.

  • Testing with this jboss-app.xml file as suggested here results in errors at loading.

https://jira.jboss.org/jira/browse/JBAS-1088

Environment

  • JBoss Enterprise Application Platform (EAP) 5.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.