logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <c...@qos.ch>
Subject Re: multiple logger hierarchies
Date Mon, 15 Nov 2004 10:52:48 GMT

Hello Rocardo,

It looks good, except one small detail:

change

  org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger("log");

to

  org.apache.log4j.Logger logger = new 
org.apache.log4j.spi.RootLogger(Level.DEBUG);

HTH,

At 09:52 AM 11/15/2004, Ricardo Trindade wrote:
>Hi,
>
>    I'm trying to configure multiple logger hierarchies, and having a bit 
> of trouble.
>
>    I tried the following :
>
>        JoranConfigurator logConfigurator = new JoranConfigurator();
>
>        InputStream logConfig = getClass().getResourceAsStream("log4j.xml");
>        org.apache.log4j.Logger logger = 
> org.apache.log4j.Logger.getLogger("log");
>        Hierarchy repository = new Hierarchy(logger);
>        logConfigurator.doConfigure(logConfig, repository);
>
>        InputStream anotherLogConfig = 
> getClass().getResourceAsStream("anotherlog.xml");
>        org.apache.log4j.Logger anotherLogger = 
> org.apache.log4j.Logger.getLogger("anotherlog");
>        Hierarchy anotherLogRepository = new Hierarchy(anotherLogger);
>        logConfigurator.doConfigure(anotherLogConfig , anotherLogRepository );
>
>        anotherLogger.debug("something happended!!!!");
>        logger.debug("something happended!!!!");
>
>    which didn't work well. Specifically, both hierarchies appear to begin 
> with a logger that has the same default logger as it's parent. I would 
> like a different root logger in each category, not descending from the 
> default logger. is this possible ?
>
>    Could repository selectors help me ?
>
>thanks
>Ricardo
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org

-- 
Ceki Gülcü

  The complete log4j manual:  http://qos.ch/eclm
  Professional log4j support: http://qos.ch/log4jSupport  



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