ignite-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sam (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (IGNITE-4863) Log4jLogger can change RootLogger logging level unexpectedly.
Date Fri, 24 Mar 2017 18:27:41 GMT

    [ https://issues.apache.org/jira/browse/IGNITE-4863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15940871#comment-15940871

Sam commented on IGNITE-4863:

Looked at code and seems like check for log configuration is made, 
                    if(!isConfigured()) { 

but not completely correct. Below is the method from Log4JLogger 

    public static boolean isConfigured() { 
        return Logger.getRootLogger().getAllAppenders().hasMoreElements(); 

It is looking at appenders from rootLogger only. It should also check for other Loggers. Probably
below code should fix it. 

    public static boolean isConfigured() { 
        Enumeration appenders = Logger.getRootLogger().getAllAppenders(); 
        if (appenders.hasMoreElements()) { 
            return true; 
        else { 
            Enumeration loggers = LogManager.getCurrentLoggers() ; 
            while (loggers.hasMoreElements()) { 
                Logger c = (Logger) loggers.nextElement(); 
                if (c.getAllAppenders().hasMoreElements()) 
                    return true; 
        return false; 

> Log4jLogger can change RootLogger logging level unexpectedly.
> -------------------------------------------------------------
>                 Key: IGNITE-4863
>                 URL: https://issues.apache.org/jira/browse/IGNITE-4863
>             Project: Ignite
>          Issue Type: Bug
>          Components: general
>    Affects Versions: 1.5.0.final
>            Reporter: Andrew Mashenkov
> Setting System property "IGNITE_CONSOLE_APPENDER" to true will set rootLogger level to
OFF that can be unexpectedly as well.
> See http://apache-ignite-users.70518.x6.nabble.com/Logging-ignite-log4j-jar-td11400.html
> Seems, we should check if there is no other loggers configured which can inherits rootLogger
logging level before raising level or turning rootLogger off.

This message was sent by Atlassian JIRA

View raw message