spring-cloud / spring-cloud/spring-cloud-commons
Log4j2Metrics reset by LoggingSystemShutdownListener
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 751
- Forks
- 744
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 9
Description
I find that the root logger's filter added by log4j2Metrics, reseted sometime after application started.
Since my applcation have multiple context, it will trigger ApplicationEnvironmentPreparedEvent multiple times, and with LoggingSystemShutdownListener and ConfigFileApplicationListener's mechanism, the configration instance in logContext will be replace multiple times, which will lose the filter add by log4j2Metrics.
For now I'm adding a SpringApplicationRunListener#start to rebind the log4j2Metrics, but since it's SpringApplicationRunListener it will also be triggered as many as context's amount. Want a good solution from team, thx!
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how LoggingSystemShutdownListener and ConfigFileApplicationListener handle repeated ApplicationEnvironmentPreparedEvent events across multiple contexts. Compare that lifecycle with the log4j2Metrics root-logger filter and the reported SpringApplicationRunListener#start workaround. Done means the filter remains bound when configuration instances are replaced, without requiring per-context rebinding.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring, spring-boot
- Domain
- backend, observability-sre
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100