Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

StatusLogger dest=file.log property creates an empty file #3579

Open
voddan opened this issue Mar 26, 2025 · 1 comment
Open

StatusLogger dest=file.log property creates an empty file #3579

voddan opened this issue Mar 26, 2025 · 1 comment
Labels
waiting-for-user More information is needed from the user

Comments

@voddan
Copy link

voddan commented Mar 26, 2025

Description

I specified <Configuration dest="file.log"> in my log4j2.xml.
I expected the status logger messages to be redirected to that file. Instead the file.log was created, but it remained empty, and all the status logging messages were printed to console as before.

Configuration

Version: 2.24.3

Operating system: Windows 11

JDK: Amazon Correto 17.0.12

Reproduction

  1. Specify <Configuration dest="file.log"> in log4j2.xml.
  2. file.log is created, but is empty
  3. Status logs are still in the console
@ppkarwasz
Copy link
Contributor

@voddan,

I am unable to reproduce the problem with the steps you provided. Can you provide a minimal reproducible example? Can you provide the logs of the initialization procedure of Log4j Core? Setting -Dlog4j2.statusLoggerLevel=INFO should be enough to see the lifecycle of the configurations for all your logger contexts.

Note

Using the dest attribute in a configuration file should be considered deprecated: StatusLogger is a global resource shared by all the logger contexts in your system.
Each configuration will reconfigure StatusLogger when it starts. This is why we don't recommend using neither the status nor the dest configuration attributes.

You question about StatusListener (#3576) provides a better way to redirect status logs to a file. I'll follow up on that.

@ppkarwasz ppkarwasz added waiting-for-user More information is needed from the user and removed waiting-for-maintainer labels Mar 27, 2025
@ppkarwasz ppkarwasz moved this from To triage to Backlog in Log4j bug tracker Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-for-user More information is needed from the user
Projects
Status: Backlog
Development

No branches or pull requests

2 participants