You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Ceki Gülcü <ce...@qos.ch> on 2002/08/28 16:22:09 UTC

Adding isConfigured method to LoggerRepository interface

In the past, developers have often complained about the difficulties
of determining whether log4j has been already configured. One possible
way is to check whether the root logger has been configured. For
example,

Logger root = Logger.getRootLogger();
boolean rootIsConfigured = root.getAllAppenders().hasMoreElements();

The slight problem with this technique is that log4j may be configured
without this being visible at the root logger level.

I propose that in log4j 1.2.7 we add the isConfigured method
(returning a boolean) in to the LoggerRepository interface. Users
would then write

LogManager.getLoggerRepository().isConfigured()

to check whether log4j was already configured or not.

Existing configurators would call loggerRepository.setConfigured(true)
when configuring log4j. User code would also have the possibility to
call this method.

--
Ceki


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>