You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Henrik Bentel <hb...@comcast.net> on 2005/04/12 06:00:24 UTC

Multiple confguration files used in shared repository

Hi

I've already tried this question in the users list, with no help.

This applies to log4j 1.2.8

I'm trying to configure a repository using multiple log4j configuration 
file (properties or xml format).
I've read previous posts on the users lists on the subject which 
confirmed that this should possible. As additional logging
configurations are read, Loggers and Appenders are added to the 
Repository without
resetting the previous configuration. That works all fine and dandy.

The problem I'm seeing is that every configuration file has to be 
consistent, it cannot
contain references to logger component(Loggers or Appenders) configured 
in a different
configuration file, even if the referenced appender already exists" in 
the repository(  it has already been
configured by an earlier configuration call).

Before boring you with more details, my question:  Is there away around 
the limitation I just described through some parts of the API?
Currently I'm just loading configuration using the standard 
PropertyConfigurator.

To add some more boring details:
The context of my issue is that I have multiple enterprise 
applications(EARs)
in an application server environment where I also have non-enterprise 
components/libraries run as part of the server classloader,
providing shared services between my enterprise applications. These 
"server classpath" libraries also use log4j so log4j.jar must be on the
server classpath. So I have a "base-log4j.properties" file loaded as 
part of server startupclass(weblogic 8 if anyone
are curious).
In addition, every enterprise application has a 
<appname>-log4j.properties file that is loaded as part of the 
application deployment.

My goal is to have the rootlogger and a base set of appenders in the 
root-log4j.properties such that everything can be  logged to
a common log file AND  every application can define their own unique 
appenders and loggers if needed in their own configuration files.
And I would like to avoid duplicating configuration in different 
properties files, if possible.
Yes, there are is a good chance of namespace conflicts, but I'm taking 
my chances for now.

I first looked into the Repository selector articles and the JNDI-based 
one added in 1.3 but it doesn't seem to help in my case.
Not until Sun adds something like enterprise application scoped JNDI 
context just like web applications has. Not just EJB component based.
Just to add another crazy question, is there such a thing as repository 
inheritance? Does that even make sense?

Like many before me I'm sure, I've discovered that logging in server 
environment is a pain in the ###.

Hope someone can show me the light or set me straight
thanks,
Henrik Bentel

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org