spring-cloud-commons
spring-cloud-commons copied to clipboard
Log4j2Metrics reset by LoggingSystemShutdownListener
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!