logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Womack <wom...@adobe.com>
Subject RE: Apache Commons Collection - CompositeConfiguration
Date Tue, 19 Jul 2005 00:01:48 GMT
Well, if CompositeConfiguration supports getting a Properties object to
represent the configuration settings, then you could plug it into the
PropertyConfigurator through doConfigure(Properties, LoggerRepository)
pretty easily.  Though there is no way to do automatic, default
configuration (ie a single property or xml file).  You'll have to write your
on code to create the CompositeConfiguration and then pass it into
PropertyConfigurator.

<related-but-not-exactly-helpful-to-your-current-context>
I think it is a weakness of the Configurator interface that it requires you
to support/specify a file, etc.  And then each configurator has to define
source specific methods.  It would be nice if it could use a "wrapper"
interface where implementations could wrap a file, or a stream, or a
CompositeConfiguration, etc.  Haven't thought about it very hard, so not
sure what it would look like, but something that says "give me all the
appender settings configured in this configuration", "give me all the logger
settings configured in this configuration", etc.  Leave it up to the
implementation to figure out the details.  Then the common code would be
responsible for actually configuring the environment using the data.  Hm.
</related-but-not-exactly-helpful-to-your-current-context>

-Mark

> -----Original Message-----
> From: Moran Ben-David [mailto:moran@place-base.com]
> Sent: Monday, July 18, 2005 3:48 PM
> To: log4j-user@logging.apache.org
> Subject: Apache Commons Collection - CompositeConfiguration
> 
> Hi.
> 
> 
> 
> I am looking to configure Log4J in my app to use a composite configuration
> (one based on multiple files).  Has anyone done this before?  (I searched
> the list and didn't find any mention of it.)   Am I correct in wanting to
> extend through org.apache.log4j.config to do this?
> 
> 
> 
> Does anyone have information on how to use the
> 
> 
> 
>             org.apache.log4j.config
> <http://logging.apache.org/log4j/docs/api-
> unstable/org/apache/log4j/config/p
> ackage-frame.html>
> 
> 
> 
> package and extend with it?  I'm going through the javadoc but was hoping
> that someone else was kind enough to document this process.
> 
> 
> 
> Here's more info on what I'm trying to do in case anyone is kind enough to
> lend some eyes and braincells:
> 
> 
> 
> I want the configuration that log4j will use to be derived from a series
> of
> files and not just from a single file.  Propreties existing in two files,
> will be overriden by the higher priority file (i.e. the earlier one in the
> list or vice versa).
> 
> 
> 
> I'm thinking that the best way to do this is to use the Apache Common
> Configuration framework's CompositeConfiguration:
> 
> 
> 
> CompositeConfiguration config = new CompositeConfiguration();
> config.addConfiguration(new SystemConfiguration());
> config.addConfiguration(new
> PropertiesConfiguration("application.properties"));
> 
> 
> 
> And then to get Log4J to pickup it's configuration from that "config"
> object.  Now comes the task of plugging into log4j.
> 
> 
> 
> Any answers to the questions above would be greatly appreciated.
> 
> 
> 
> Thanks
> 
> Moran Ben-David
> 
> http://www.place-base.com
> 
> 



---------------------------------------------------------------------
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