apache / apache/logging-log4j2

`Appender#stop` is not idempotent

Open
#1,653 0 comments 0 reactions 1 assignee Claimed by @ppkarwasz View on GitHub
appenders bug
Dominant language
Java
Stars
3.6k
Forks
1.7k
Avg merge
21h 30m
Merged PRs (30d)
27

Description

## Description

In Log4j 2 managers are reference counted: if you have two `FileAppender`s 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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.