-
1. Re: logback and JBoss 7.1.1.Final
beve Apr 19, 2012 4:06 AM (in response to hd0815)Hi,
I'm not sure about this but could you try adding the 'org.apache.log4j' module to the list of excluded modules. I believe that it this module is added implicitily and might be an issue.
Regards,
/Daniel
-
2. Re: logback and JBoss 7.1.1.Final
hd0815 Apr 19, 2012 5:58 AM (in response to beve)I added org.apache.log4j to the excluded modules in deployment tag and every sub-deployment tag, but that didn't fix the problem. No log file is added to my user defined log directory. Everything is logged into server.log.
-
3. Re: logback and JBoss 7.1.1.Final
dmlloyd Apr 19, 2012 1:58 PM (in response to hd0815)hd0815 wrote:
Hi,
I'm facing problems in getting my enterprise application read the logback.xml and configure my logger.
I read several discussions about this issue already, but nothing seems to work for me. For some reasons I need to use logback and cannot switch to a different logging framework.
I tried to exclude org.slf4j in my deployment and all sub-deployments in jboss-deployment-structure.xml, but this had no effect. Everything is still logged to server.log and only to server.log.
Here is my jboss-deployment-structure.xml from the ear-File:
<jboss-deployment-structure> <deployment> <exclusions> <module name="org.sl4j" /> <module name="org.slf4j.impl" /> </exclusions> </deployment> <sub-deployment name="ejb.jar"> <exclusions> <module name="org.sl4j" /> <module name="org.slf4j.impl" /> </exclusions> </sub-deployment> <sub-deployment name="web.war"> <exclusions> <module name="org.sl4j" /> <module name="org.slf4j.impl" /> </exclusions> </sub-deployment> </jboss-deployment-structure>
The structure of my project is as follows:
ear.ear | |--- lib . | . |--- slf4j-api.jar . |--- logback-classic.jar . |--- logback-core.jar |--- ejb.jar . |--- logback.xml |--- META-INF . |--- jboss-deployment-structure.xml |--- web.war
In logback.xml a different log folder is defined. Nothing is logged to this folder.
I think the problem is that you spelled "slf4j" wrong in your exclusions.
-
4. Re: logback and JBoss 7.1.1.Final
sfcoy Apr 19, 2012 10:05 PM (in response to hd0815)This does not work for exactly the same reasons that affect log4j.
As the logback jars are in the EAR/lib directory, they cannot "see" the logback.xml file in the ejb.jar as it's in a different classloader.
Your choices are to:
- Specify -Dlogback.configurationFile=/path/to/config.xml on the command line
- Explicitly configure logback from a servlet context listener
-
5. Re: logback and JBoss 7.1.1.Final
hd0815 Apr 20, 2012 5:12 AM (in response to dmlloyd)Thanks, I didn't realize that. It seems that I now get the correct logging API but in fact it still isn't realizing the logback.xml. This may be because of the Problem metioned by Stephen Coy. I'm on that already.
-
6. Re: logback and JBoss 7.1.1.Final
hd0815 Apr 20, 2012 9:18 AM (in response to hd0815)Well, after I fixed my typo in jboss-deployment-structure.xml it didn't work. But I found out that this file wasn't deployed by my JBoss Tools Eclipse plugin. After I copied the file to ear.ear/META-INF in the deployment folder the application was able to find and read logback.xml located at ear.ear/ejb.jar. I have to add that I have a fully exploded deployment. This means even ejb.jar and web.war are exploded archives like JBoss Toold does. I haven't tested if the logback config file can be read when it's archived.