-
1. Re: Seperate log4j.xml for each application
jwcone May 27, 2007 7:10 PM (in response to lost_traveller)The Wiki is your friend.
http://wiki.jboss.org/wiki/Wiki.jsp?page=ScopedLoggingConfig -
2. Re: Seperate log4j.xml for each application
bensonfungjava Jun 28, 2007 2:44 AM (in response to lost_traveller)Hi,
Both suggestion from the Wiki don't work. It is cheating.
I just cut and paste the code into my code, it doesn't work at all.
too bad
Benson -
3. Re: Seperate log4j.xml for each application
lost_traveller Jun 28, 2007 3:52 AM (in response to lost_traveller)Yeah I couldn't get it to work either, allbeit I didn't try for very long.
It seems to be a poor feature of Log4J that you can only have one config per JVM. In the end we have to have 1 log4j config in our EAR file which has knowledge of every application deployed and the JBoss log4j config too, as you can understand this is not ideal. -
4. Re: Seperate log4j.xml for each application
meissa Jun 28, 2007 5:05 AM (in response to lost_traveller)the problem is not comming log4j. It's a jboss classloading problem.
In jboss4.3 sp1 version, you could have a log4j.jar version for each of you application.
But with jboss 4.2 version doing so, you may experience with exception belowlog4j:ERROR A "org.jboss.logging.appender.FileAppender" object is not assignable to a "org.apache.log4j.Appender" variable. log4j:ERROR The class "org.apache.log4j.Appender" was loaded by log4j:ERROR [WebappClassLoader delegate: false repositories: /WEB-INF/classes/ ----------> Parent Classloader: java.net.FactoryURLClassLoader@18c10af ] whereas object of type log4j:ERROR "org.jboss.logging.appender.FileAppender" was loaded by [org.jboss.system.server.NoAnnotationURLClassLoader@1a33d48]. log4j:ERROR Could not instantiate appender named "FILE".
It seem not possible to override jboss server librairies (log4j.jar is present in jboss server lib and has been customised).
Even if you try to isolate classloadiing, it's not working witk log4j.
Meissa -
5. Re: Seperate log4j.xml for each application
stlecho Dec 5, 2007 3:58 PM (in response to lost_traveller)After searching on the different forums, it seems that there is no clear solution to solve this issue. With the application we are developing, the same problem occurs.
We are deploying an app1.WAR and a app2.EAR file in JBoss. Each of them has its own log4j.xml and logging occurs respectively in app1.log and app2.log.
When JBoss is started, JBoss' default server.log file is used for the logging. When app1.WAR is "activated", app1.log is used but server.log is no longer used. When app2.EAR is "activated", app2.log is used but app1.log is no longer used. This behavior seems to be totally random.
Changing JBoss' default log4j.xml file solves the above described issue, but it remains a workaround and it surprises me that JBoss does not allow an application-specific logging configuration.
What are the guidelines that should be followed to allow separate logging for each application ?
Regards, Stefan Lecho.