[slf4j-dev] [Bug 235] Category class in log4j-over-slf4j does not contain getAllAppenders()

bugzilla-daemon at pixie.qos.ch bugzilla-daemon at pixie.qos.ch
Sat Aug 20 03:11:55 CEST 2011


http://bugzilla.slf4j.org/show_bug.cgi?id=235

--- Comment #1 from Anthony Whitford <anthony at whitford.com> 2011-08-20 03:11:55 CEST ---
I traced the Sigar code (SigarLog.java) and discovered that they are doing
this:

    private static boolean isLogConfigured() {
        //funny, log4j has no api to determine if logging has been
        //configured? .. yet bitches at you like a mo-fo when logging
        //has not been configured.
        return Logger.getRootLogger().getAllAppenders().hasMoreElements();
    }
...
    public static Logger getLogger(String name) {
        Logger log = Logger.getLogger(name);
        if (!isLogConfigured()) {
            BasicConfigurator.configure();
        }
        return log;
    }

Presumably, I should be able to replace log4j.jar with log4j-over-slf4j.jar and
continue to function.

-- 
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the slf4j-dev mailing list