logging-log4j2 icon indicating copy to clipboard operation
logging-log4j2 copied to clipboard

LoggerContext fires 2 PropertyChangeEvent with 'propertyName' set to 'config' on a single reconfigure

Open JWT007 opened this issue 9 months ago • 1 comments

The LoggerContext fires two PropertyChangeEvents of type LoggerContext.PROPERTY_CONFIG on a reconfigure.

A single reconfigure creates events in the following order:

The first one the oldValue == newValue because it is called during updateLogggers

java.beans.PropertyChangeEvent:
propertyName=config; 
oldValue=com.tsystems.pwc.config.logging.log4j.api.config.DefinedCompositeConfiguration@7470563a
newValue=com.tsystems.pwc.config.logging.log4j.api.config.DefinedCompositeConfiguration@7470563a 

The second one comes when the reconfiguration completes and is for the actual configuration change

java.beans.PropertyChangeEvent:
propertyName=config; 
oldValue=com.tsystems.pwc.config.logging.log4j.api.config.DefinedCompositeConfiguration@3b99e345
newValue=com.tsystems.pwc.config.logging.log4j.api.config.DefinedCompositeConfiguration@7470563a

I am wondering if the updateLoggers PropertyChangeEvent should use a different property-name.

JWT007 avatar Mar 17 '25 19:03 JWT007

I am wondering if the updateLoggers PropertyChangeEvent should use a different property-name.

@JWT007, can you elaborate on this suggestion, please?

Would you also mind sharing the (backward) compatibility risks of such a change?

vy avatar Apr 13 '25 18:04 vy