LOG4J 1.2 in JBOSS AS 7.2.0 [not assignable]
lili2013 Aug 13, 2013 3:28 AMHello,
I'm trying to use log4j in JBOSS AS 7.2.0,
It's OK in JBOSS 4 though.
I created a jboss-deployment-structure.xml to exclude the "org.apache.log4j" module, and place it in my project, just like this:
TestDefault.ear
|--EJB_TestDefault.jar
|--TestDefault.war-
|--WEB-INF/classes/log4j.xml
|--META-INF/jboss-deployment-structure.xml
|--lib/log4j.xml;log4j-1.2.17.jar
|--META-INF/jboss-deployment-structure.xml
after deploying, error is printed out.
---------------------------------------------
12:41:09,991 ERROR [stderr] (http-/127.0.0.1:8080-1) log4j:ERROR A "org.apache.log4j.xml.DOMConfigurator" object is not assignable to a "org.apache.log4j.spi.Configurator" variable.
12:41:09,991 ERROR [stderr] (http-/127.0.0.1:8080-1) log4j:ERROR The class "org.apache.log4j.spi.Configurator" was loaded by
12:41:09,991 ERROR [stderr] (http-/127.0.0.1:8080-1) log4j:ERROR [ModuleClassLoader for Module "deployment.TestDefault.ear:main" from Service Module Loader] whereas object of type
12:41:09,991 ERROR [stderr] (http-/127.0.0.1:8080-1) log4j:ERROR "org.apache.log4j.xml.DOMConfigurator" was loaded by [ModuleClassLoader for Module "org.jboss.log4j.logmanager:main" from local module loader @1acd47 (finder: local module finder @19b04e2 (roots: C:\jboss-eap\modules,C:\jboss-eap\modules\system\layers\base))].
12:41:09,991 ERROR [stderr] (http-/127.0.0.1:8080-1) log4j:ERROR Could not instantiate configurator [org.apache.log4j.xml.DOMConfigurator].
12:41:10,006 ERROR [stderr] (http-/127.0.0.1:8080-1) log4j:WARN No appenders could be found for logger (CF_OP).
12:41:10,006 ERROR [stderr] (http-/127.0.0.1:8080-1) log4j:WARN Please initialize the log4j system properly.
12:41:10,006 ERROR [stderr] (http-/127.0.0.1:8080-1) log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
---------------------------------------------
My log4j.xml is:
<appender name="BF_OP" class="org.apache.log4j.DailyRollingFileAppender">
<param name="File" value="C:/logs/cf_op.log" />
<param name="DatePattern" value="'.'yyyy-MM-dd" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d [%t] - %m%n"/>
</layout>
</appender>
<category name="CF_OP">
<priority value="info"/>
<appender-ref ref="CF_OP"/>
</category>
It seems that JBOSS has found my log4j-1.2.17.jar...
Although I have added jboss-deployment-structure.xml,I feel that JBoss EAP 6 log4j module isn't excluded.
I appreciate any guidance.Thanks.
Regards
Bates