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 "Mak, Howard" <hm...@vaultus.com> on 2007/12/17 20:05:30 UTC

logger w/o any appender

If my log4j.properties has
        log4j.logger.MYLOG = OFF
        log4j.additivity.MYLOG = false

Log4j prints
        log4j:WARN No appenders could be found for logger (MYLOG.SUBLOG).
        log4j:WARN Please initialize the log4j system properly.

Is an appender always required even if log level is OFF?

Thanks for any help.

- Howard

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


RE: logger w/o any appender

Posted by "Blok, Eelke" <ee...@numico.com>.
I would say that if the situation that a warning is pointing out is as
expected, you can ignore it (after all, it's a warning, not an error).
However, commonly, you configure loggers to log something, and if there
are no appenders to catch the log messages produced by the logger, 9
times out of 10 that would not be what you want and may indicate a
mistake in your configuration. Hence, a warning is produced. 

Apparently, the warning mechanism doesn't check if the logger has been
turned off. (With that said, logger log level configuration tends to be
more dynamic, being changed all the time to change which parts of the
logger tree are examined, while appender configuration is more static;
typically you would not shift around or remove appenders just because
they would not receive any log message for the current logger
configuration. The logger configuration may be different tomorrow, or in
five minutes, at which time a missing appender may well be a problem, so
not checking whether the logger happens to be turned off can actually be
useful, in some situations).

-----Original Message-----
From: Mak, Howard [mailto:hmak@vaultus.com] 
Sent: maandag 17 december 2007 20:06
To: 'log4j-user@logging.apache.org'
Subject: logger w/o any appender

If my log4j.properties has
        log4j.logger.MYLOG = OFF
        log4j.additivity.MYLOG = false

Log4j prints
        log4j:WARN No appenders could be found for logger
(MYLOG.SUBLOG).
        log4j:WARN Please initialize the log4j system properly.

Is an appender always required even if log level is OFF?

Thanks for any help.

- Howard

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




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