logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ionel GARDAIS <igard...@yahoo.fr>
Subject switching between two appenders
Date Wed, 29 Sep 2004 12:48:34 GMT
Hi,

I have two appenders : ConsoleAppender and
FileAppender.
These two appenders are attached to a unique logger.

Is there a way to "mute" a logger or the other "on the
fly" so I can log on Console only, FileAppender only
or both ?

BTW, my logging initialization is like this :

<code>
Logger log4jLogger = null;
static {
  Layout patternLayout = new PatternLayout("%d [%t]
%-5p - %m%n");
  Appender consoleAppender = new
ConsoleAppender(patternLayout);
  log4jLogger = Logger.getLogger("myClass");
  log4jLogger.addAppender(consoleAppender);
  log4jLogger.setLevel(Level.ALL);
}
</code>

As i am adapting a proprietary logging API to Log4j,
this is the only initialization part I am going thru.
Classes never reference the log4jLogger logger.

According to this, what about the rootLogger ?
What are its configuration values (appenders, level) ?
Should I better use
<code>
  log4jLogger = Logger.getRootLogger();
</code>
instead of
<code>
  log4jLogger = Logger.getLogger("myClass");
</code>

in order to init only the root logger ?


Thanks for your answers,
Ionel


	

	
		
Vous manquez d’espace pour stocker vos mails ? 
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour dialoguer
instantanément avec vos amis. A télécharger gratuitement sur http://fr.messenger.yahoo.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