[
https://issues.apache.org/jira/browse/LOG4J2-2161?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16303968#comment-16303968
]
paladox commented on LOG4J2-2161:
---------------------------------
I did ask a question on the user forum, but i did alot of digging and found
this did not exist, so i am filling this as a feature request please.
> 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)