N0tre3l opened a new pull request, #287:
URL: https://github.com/apache/logging-log4net/pull/287

   ## Problem
   
   During reconfiguration (`XmlConfigurator.Configure` in Merge mode),
   `XmlHierarchyConfigurator.ParseChildrenOfLoggerElement` called
   `RemoveAllAppenders()` **first**, then parsed the XML and re-added appenders
   one by one. Any log event fired during the XML parse window (10-50 ms in
   typical applications) was silently dropped because `CallAppenders` found
   `_appenderAttachedImpl == null`.
   
   Measured impact in a reproducible test: **95.9 % of events lost** during a
   50 ms simulated reconfiguration window.
   
   ## Changes
   
   ### `Logger.cs` - new `ReplaceAppenders(IEnumerable<IAppender>)` method
   Removes the old appender collection and adds all new appenders inside a
   **single writer lock**, so the logger is never in a zero-appender state for
   more than a few microseconds (the lock acquisition time).
   
   ### `XmlHierarchyConfigurator.cs` - collect-then-swap in 
`ParseChildrenOfLoggerElement`
   All new appenders are resolved from XML into a `List<IAppender>` **before**
   the live logger is touched. Then `Logger.ReplaceAppenders()` is called once
   to perform the atomic swap, rather than the previous 
remove-then-add-one-by-one pattern.
   
   ### `Hierarchy.cs` - reset `EmittedNoAppenderWarning` in `ResetConfiguration`
   The existing warning flag was never reset between reconfiguration cycles,
   silencing the "No appender" diagnostic permanently after the first
   configuration. This adds a single `EmittedNoAppenderWarning = false;` so that
   the warning can fire again during subsequent reconfiguration cycles, making
   any remaining data loss visible to operators.
   
   ## Testing
   
   Manually verified that:
   - `XmlConfigurator.Configure` still attaches the correct appenders after
   -   reconfiguration in both Merge and Overwrite modes.
   - - The zero-appender window is no longer observable under concurrent 
logging load.
   Refs: Apache Logging Services PMC discussion (Apr 2026)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to