aspose file tools*
The moose likes JBoss/WildFly and the fly likes JBoss and log4j (I want a separate log4j configuration for my application) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "JBoss and log4j (I want a separate log4j configuration for my application)" Watch "JBoss and log4j (I want a separate log4j configuration for my application)" New topic
Author

JBoss and log4j (I want a separate log4j configuration for my application)

Noelle Raine
Greenhorn

Joined: Oct 08, 2009
Posts: 1
I have an application running on JBoss and have decided to use log4j. I'm trying to set it up in such a way that I can maintain/control my own log4j setup/configuration in each application I create, separate from the JBoss log4j configuration. (I'd rather not have to update one big log4j.xml with each application I write. I'd rather control it in each application, if I choose to). I've found various things online, none of which I've been able to get working. The latest thing I've tried is a Log4jRepositorySelector a la http://www.jboss.org/community/wiki/Log4jRepositorySelector .

I'm not getting any errors when my code runs, but I'm also not getting any log4j comments written to a separate application log (or anywhere, not even the server.log).

Any help getting this working, pointers on where I'm going wrong, or advice are welcome. Thanks!

This is the AppRepositorySelector class:



And the AppContextListener:



My web.xml has this in it beneath the display-name and description, but prior to my security-constraint (web.xml is in my WEB-INF folder):


This is my log4j.xml (also in the WEB-INF folder):



And finally, this is my 'controller' that attempts to use log4j:



Sorry this is so long but I wanted to get all my info in. Any ideas? Thanks!
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10059
    
163

See if this helps http://www.jboss.org/index.html?module=bb&op=viewtopic&t=128979#4125416


[My Blog] [JavaRanch Journal]
 
 
subject: JBoss and log4j (I want a separate log4j configuration for my application)