-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Appender#stop is not idempotent #1653
Copy link
Copy link
Open
Labels
appendersAffects one or more Appender pluginsAffects one or more Appender pluginsbugIncorrect, unexpected, or unintended behavior of existing codeIncorrect, unexpected, or unintended behavior of existing code
Milestone
Metadata
Metadata
Assignees
Labels
appendersAffects one or more Appender pluginsAffects one or more Appender pluginsbugIncorrect, unexpected, or unintended behavior of existing codeIncorrect, unexpected, or unintended behavior of existing code
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
To triage
Description
In Log4j 2 managers are reference counted: if you have two
FileAppenders writing to the same file, there will be a singleFileManagerwith a reference count of 2.Calling
stop()on a stopped appender always callsstop()on the underlying manager. In the situation described above it is effectively possible to stop both file appender by callingstop()twice on one of them.This a problem, because those appenders might not even be in the same configuration or attached to the same logger context.
Configuration
Version: up to 2.20.0 and 3.0.0-alpha1
Reproduction
Call
stop()multiple times on a file appender. All other appenders pointing to the same file will stop logging.