jboss和log4j

在启动jboss的时候,发现error错误,如下:
            16:16:41,884 ERROR [STDERR] log4j:ERROR A "org.jboss.logging.appender.FileAppender" object is not assignable to a "org.apache.log4j.Appender" variable.
            16:16:41,884 ERROR [STDERR] log4j:ERROR The class "org.apache.log4j.Appender" was loaded by 
            16:16:41,884 ERROR [STDERR] log4j:ERROR [WebappClassLoader
  delegate: false
  repositories:
    /WEB-INF/classes/
----------> Parent Classloader:
java.net.FactoryURLClassLoader@8aa2d
] whereas object of type 

        而相同的项目在tomcat下面是不会报错的,查明原因后发现,原来jboss自己带了日志功能,而建立web项目的时候它自己本身也带着日志功能(你的项目中应该有spring),造成冲突。

 

解决办法:

修改jboss-service.xml

1)

<mbean code="org.jboss.logging.Log4jService" name="jboss.system:type=Log4jService,service=Logging">
        <attribute name="ConfigurationURL">resource:log4j.xml</attribute>
        <attribute name="CatchSystemOut">false</attribute>
        <attribute name="Log4jQuietMode">true</attribute>
</mbean>

2)

<attribute name="Java2ClassLoadingCompliance">true</attribute>
<attribute name="UseJBossWebLoader">true</attribute>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值