Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Appender#stop is not idempotent #1653

Open
ppkarwasz opened this issue Aug 1, 2023 · 0 comments
Open

Appender#stop is not idempotent #1653

ppkarwasz opened this issue Aug 1, 2023 · 0 comments
Labels
appenders Affects one or more Appender plugins bug Incorrect, unexpected, or unintended behavior of existing code
Milestone

Comments

@ppkarwasz
Copy link
Contributor

Description

In Log4j 2 managers are reference counted: if you have two FileAppenders writing to the same file, there will be a single FileManager with a reference count of 2.

Calling stop() on a stopped appender always calls stop() on the underlying manager. In the situation described above it is effectively possible to stop both file appender by calling stop() 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.

@ppkarwasz ppkarwasz added this to the 2.x milestone Oct 5, 2023
@jvz jvz added bug Incorrect, unexpected, or unintended behavior of existing code plugins Affects the plugin system appenders Affects one or more Appender plugins and removed plugins Affects the plugin system labels Oct 15, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
appenders Affects one or more Appender plugins bug Incorrect, unexpected, or unintended behavior of existing code
Projects
None yet
Development

No branches or pull requests

2 participants