Getting logback and slf4j to work in JBoss AS 7
As usual, it has to do with classloading and that JBoss internally also uses slf4j and logback. As everyone seems to state just about everywhere, JBoss classloading has completely changed in AS 7. Here's the recipe for this particular problem.
Create a file called "jboss-deployment-structure.xml" in the META-INF directory for an EAR or WEB-INF directory for a WAR. This file can contain a lot of different stuff to tweak the classloader, but for the logback case this is enough:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<exclusions>
<module name="org.apache.commons.logging" />
<module name="org.apache.log4j" />
<module name="org.jboss.logging" />
<module name="org.jboss.logging.jul-to-slf4j-stub" />
<module name="org.jboss.logmanager" />
<module name="org.jboss.logmanager.log4j" />
<module name="org.slf4j" />
<module name="org.slf4j.impl" />
</exclusions>
</deployment>
</jboss-deployment-structure>
For the EAR case, you'll probably need to add a subdeployment for each application (both wars and ejbs) with the same exclusions. For more details, consult the JBoss documentation on the subject.
UPDATE
I ran into the same issue with log4j2 on EAP 6.3 and the recipe still works. It is important to add a separate exclusion for each sub-deployment or JBoss will eat your log messages and they'll go into the JBoss internal logger.
Getting logback and slf4j to work in JBoss AS 7的更多相关文章
- logback:logback和slf4j中的:appender、logger、encoder、layout
(1)appender 1.appender标签是logback配置文件中重要的组件之一.在logback配置文件中使用appender标签进行定义.可 以包含0个或多个appender标签. 2.a ...
- log4j 、logback 以及slf4j三者之间的关系
在项目的开发中由于对于log4j.logback以及slf4j之间的关系和相关的知识不能清晰掌握,在业余时间进行记录. 1.三者之间的关系 1) 简答的讲就是slf4j是一系列的日志接口,而log4j ...
- Logback,SLF4J,Log4J2。了解它们并学习如何使用。(翻译)
背景 如果您正在或在任何Java项目上工作,则可能已记录了一些debug,error或info语句以进行调试或跟踪.通过将库记录到磁盘或其他某种介质上的文件中来写这些语句. 日志记录是任何项目的关键方 ...
- logback和slf4j的使用之logger使用
原文:https://blog.csdn.net/cw_hello1/article/details/51923814 一.logger标签描述:(了解logger标签之前先看看两个重要概念) 1.主 ...
- logback + slf4j + jboss + spring mvc
logback.log4j.log4j2 全是以同一个人为首的团伙搞出来的(日志专业户!),这几个各有所长,log4j性能相对最差,log4j2性能不错,但是目前跟mybatis有些犯冲(log4j2 ...
- lombok+slf4j+logback SLF4J和Logback日志框架详解
maven 包依赖 <dependency> <groupId>org.projectlombok</groupId> <artifactId>lomb ...
- How to setup SLF4J and LOGBack in a web app - fast--转载
原文:https://wiki.base22.com/display/btg/How+to+setup+SLF4J+and+LOGBack+in+a+web+app+-+fast Logback is ...
- 使用 SLF4J + LogBack 构建日志系统(转)
转载自:http://www.cnblogs.com/mailingfeng/p/3499436.html 上次我们讨论了如何选择一个好的开源日志系统方案,其中的结论是:使用 SLF4J + LogB ...
- 从源码来理解slf4j的绑定,以及logback对配置文件的加载
项目中的日志系统使用的是slf4j + logback.slf4j作为一个简单日志门面,为各种loging APIs(像java.util.logging, logback, log4j)提供一个简单 ...
随机推荐
- Django中settings设计模式(单例模式)
配置文件: 需求:配置文件,默认配置和手动配置分开,参考django的配置文件方案,默认配置文件放在项目容器内部,只让用户做常用配置. /bin/settings.py(手动配置) PLUGIN_IT ...
- Tesseract 4 自行构建支持双引擎的tessdata 文件
Tesseract 4 版本具备两种识别引擎:新的基于LSTM(神经网络)引擎与传统引擎.通过在初始化时设定不同的EngineMode启动. OCR Engine modes: 0 Legacy en ...
- pwd命令详解
基础命令学习目录首页 原文链接:https://blog.csdn.net/gnail_oug/article/details/70664458 pwd是Print Working Directory ...
- alias命令详情
基础命令学习目录首页 原文链接:http://c.biancheng.net/view/938.html 给命令设置别名,你可以把它当作命令的"小名",但是这样做有什么意义呢? 比 ...
- Linux 做网关
首先创建两张路由表,只需要添加到相应的文件中即可,Linux一共支持255个路由表,rt_tables文件中默认已经存在了三张路由表,分别是: 255 local 254 main 2 ...
- JVM新生代老年代详解
1.为什么会有年轻代 我们先来屡屡,为什么需要把堆分代?不分代不能完成他所做的事情么?其实不分代完全可以,分代的唯一理由就是优化GC性能.你先想想,如果没有分代,那我们所有的对象都在一块,GC的时候我 ...
- maven:新建的maven工程需要添加一下插件
//下面的代码是改变maven的默认使用Java版本,本机是jdk1.7所以用1.7<plugins> <plugin> <groupId>org.apache.m ...
- 一个demo 理解 vuex
相比接触vue的同学们已经看了官方文档了.这里我用一个简单的demo来阐述下vuex的知识点,虽然简单,但是容易理解.也加深自己的记忆. 用脚手架建立个项目vue init webpakc-simpl ...
- 冲刺One之站立会议3 /2015-5-16
2015-5-16 今天我们主要完成一部分服务器端的内容,因为只有服务器端完成了主要功能其他的部分才可以测试有没有成功实现目标.具体包括服务器登陆时需要的端口号.启动时间.服务器状态的显示.在线人数等 ...
- Android里面安装windows系统
安装前请确认以下条件:①:存储卡需要有大于302M的空间. 下载安装:1.下载文件并安装:①:下载地址:http://kuai.xunlei.com/d/hWIkAAIkJwAawgZUa3c ...