logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: Adding multiple configuration files to log4j
Date Sat, 24 Jun 2006 15:31:55 GMT

You can [re]configure Log4j as many times as you want.  Configuration 
is additive.  Once reconfiguration does not blow away the old.  I'm 
not sure what you describe is something Log4j ought to support at its 
core.  You are welcome to create your own startup class that behaves 
this way and just applies each configuration in turn.  However, I 
think this would become confusing.  The parent application is really 
the master of configuration.  Libraries shouldn't force a 
configuration on application code.  It is the end-user (developer) 
that cares about what they want to see in the logs, not the 
library.  I suggest you make it easier on yourself and put any 
configuration you desire into one file.

Jake

At 04:55 AM 6/23/2006, you wrote:
 >Hi,
 > Currently, i could not find a way to use add multiple files as
 >configuration files for log4j. Here's why i needed the same:
 >
 > - I have a 3rd party application which uses log4j and has its
 >configurations in log4j.xml
 > - I am integrating my application with the 3rd party application.
 > - My application also uses log4j and configures the same using say
 >myAppLog4j.xml.
 > - I could have added(appended) my configurations to the log4j.xml
 >used by the 3rd party application
 > - But i would like to maintain both these configurations in 2 files.
 > - The way i tell log4j to configure using myAppLog4j.xml is by using:
 >
 >PropertyConfigurator.configure(Loader.getResource("myAppLog4j.xml"));
 >  Using this will make log4j configure *only* through myAppLog4j.xml.
 >It would be really great, if we could have a API, something like:
 >  addConfiguration(String fileName);
 >or
 >addConfiguration(File file);
 >or maybe
 >addConfiguration(Resource configResource);
 >  All these APIs would add the config file to a collection which will
 >maintain the configuration files.
 >  Log4j could then maintain a collection of configuration files to use
 >for configuring log4j.
 >  Is this possible? Or currently is there some way through which i can
 >do the same?
 >
 >
 >  regards,
 >  -Jaikiran
 >
 >
 >---------------------------------
 > Yahoo! India Answers: Share what you know. Learn something new Click here
 >Catch all the FIFA World Cup 2006 action on Yahoo! India Click here


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


Mime
View raw message