Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to have everything except my war in an ear use the same log4j.xml  RSS feed

Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been reading over the RepositorySelector examples located on the wiki here:,
and I manged to use that to get my own war file's log4j.xml file picked up.

I obviously have other jars such as an ejb.jar and a common.jar that are also bundled up in the ear along with the war. How do I get everything else in the ear, other than the war (or I'd settle for everything including the war), to all use a common log4j.xml file that I can bundle in the ear?

Ideally I'd like to code one log4j.xml for my ear, but I'm not exactly sure how to go about setting this up? I'd need some way I guess when the first thing in the ear is accessed or when jboss is going to deploy it, that it loads some kind of init class that can load a RepositorySelector implementation. I'm not sure how to best accomplish that or if all my jars including my webapp would have access to the config loaded up. The wiki ebj.jar example shows an example of initializing the RepositorySelector from an EJB constructor. I certainly don't want to have to call init from every constructor that might be used in classes in my jars.

Thanks in advance for any help.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!