You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "paladox (JIRA)" <ji...@apache.org> on 2017/12/26 18:48:00 UTC

[jira] [Created] (LOG4J2-2161) Support reloading configuration without losing prevous configuation

paladox created LOG4J2-2161:
-------------------------------

             Summary: Support reloading configuration without losing prevous configuation
                 Key: LOG4J2-2161
                 URL: https://issues.apache.org/jira/browse/LOG4J2-2161
             Project: Log4j 2
          Issue Type: Bug
            Reporter: paladox


Hi, in log4j1 it was possible to reset configuation without losing prevous configuation. You used PropertyConfigurator.configure and according to the doc it did "Read configuration from a file. The existing configuration is not cleared nor reset." (https://github.com/apache/log4j/blob/c5f4279081091e562c44bb753f6e52dc6be5fa52/src/main/java/org/apache/log4j/PropertyConfigurator.java#L120)

In log4j2 when you do programic configuration after log4j2 initialised it would just reset back to what's in the file on a reconfigure.

https://github.com/GerritCodeReview/gerrit/blob/09786353f76b778a76a61a092adf60a41fbc3cfd/java/com/google/gerrit/server/util/SystemLog.java

Reading https://logging.apache.org/log4j/2.x/manual/customconfig.html "Programmatically Modifying the Current Configuration after Initialization" would explain why it keeps resetting it for me.

Im wondering if there could be a new method added so that reconfigure does not reset unless you specify reset please? Reason why is in gerrit we programatically add appenders like async loggers or just RollingFile appenders.

This is some of the places we programatically do it https://github.com/GerritCodeReview/gerrit/blob/61b19d28912dc13d3f1838ed5b57b06b612042ed/java/com/google/gerrit/pgm/util/ErrorLogFile.java

https://github.com/GerritCodeReview/gerrit/blob/09786353f76b778a76a61a092adf60a41fbc3cfd/java/com/google/gerrit/sshd/SshLog.java#L71

https://github.com/GerritCodeReview/gerrit/blob/09786353f76b778a76a61a092adf60a41fbc3cfd/java/com/google/gerrit/server/util/SystemLog.java

(This is in log4j1, i am currently trying to convert to log4j2).

But we also allows users to add there own configuation by using a file thus on a start up this works but when a users resets a log level it will then reset from the file thus losing the programic configuation we did. I get this error after a reconfigure "ERROR StatusLogger Attempted to append to non-started appender sshd_log".

Im also aware that there is monitorInterval which would then remove the programic configuation we did.




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)