You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Henrik Bentel <hb...@gmail.com> on 2005/04/07 06:26:09 UTC

Re: Multiple configuration files

Anyone?
Impossible?

Hope someone has some insight
-Henrik


On Mar 30, 2005 9:09 PM, Henrik Bentel <hb...@gmail.com> wrote:
> Hi
> 
> I'm trying to configure a repository using multiple log4j
> configuration file (properties or xml format).
> I've read previous posts from 2002 and 2003 on the subject which
> confirmed that this should possible. As additional configuration is
> read, Loggers and appenders are added to the Repository without
> resetting the previous configuration. That works all fine and dandy.
> 
> My problem is that loggers can't reference appender in a different
> configuration file, even if the referenced appender has already been
> configured in the repository.
> 
> Example:
> I have a "root" log4j configuration which defines the root logger and
> a single "common" appender "commonApppender". This configuration is
> loaded first. Think server startup.
> 
> Then I have another specialized log4j configuration file which defines
> another appender "appenderA" plus a logger "foo". Think of this as
> application specific log4j configuration file.
> 
> This "foo" logger is attached to both "commonApppender" and
> "appenderA". However, when the configuration file is read in, log4j
> prints a warning stating it cannot find "commonApppender" in the
> configuration. And of course no logging goes to "commonApppender" from
> logger "foo"
> 
> Is there a way of getting log4j to do some sort of lazy resolving of
> components such that this sort of cross-configuration file referencing
> is possible?
> Or should this actually work, but I'm just doing it wrong?
> 
> The "root" configuration is loaded through auto discovery, and the
> specialized or application configuration is loaded like this:
> -----
> Properties props = ... //getting specialized log4j properties file
> PropertyConfigurator.configure(props);
> -------------
> 
> I've also tried the nonstatic method of doConfigure, no change.
> 
> thanks,
> Henrik Bentel
>

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