Skip to content

close the outgoing appenders before activating the new ones #321 - #322

Merged
FreeAndNil merged 3 commits into
masterfrom
Feature/322-reconfiguration-file-lock
Sep 22, 2026
Merged

FreeAndNil merged 3 commits into
masterfrom
Feature/322-reconfiguration-file-lock

Conversation

@FreeAndNil

@FreeAndNil FreeAndNil commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #321

@FreeAndNil
FreeAndNil force-pushed the Feature/322-reconfiguration-file-lock branch from cfc1317 to 1813208 Compare September 19, 2026 21:07
@FreeAndNil FreeAndNil changed the title Feature/322 reconfiguration file lock close the outgoing appenders before activating the new ones #321 Sep 19, 2026
- XmlHierarchyConfigurator activated a new appender while the outgoing
  one still held its file, so ConfigureAndWatch failed with "Unable to
  acquire lock on file"
- regression from 592d18d (#287)
- ParseAppender collects into _pendingActivations, which Configure
  drains once every logger has swapped
- the symptom is Windows only: .NET on Linux does not enforce FileShare
  within a process, so the test asserts the open/close order instead
- the entry claimed #321, which is the FileAppender reconfiguration issue,
  filed a day after this landed
- the Antora dependency work came through #320, so the id, the link and
  the file name follow that
@FreeAndNil
FreeAndNil force-pushed the Feature/322-reconfiguration-file-lock branch from 1813208 to d512f94 Compare September 21, 2026 18:20
@FreeAndNil
FreeAndNil changed the base branch from master to Feature/2.x September 22, 2026 11:05
@FreeAndNil
FreeAndNil changed the base branch from Feature/2.x to master September 22, 2026 11:05
@FreeAndNil
FreeAndNil marked this pull request as ready for review September 22, 2026 11:06
@FreeAndNil FreeAndNil added this to the 3.5.0 milestone Sep 22, 2026
@gdziadkiewicz
gdziadkiewicz requested a lite review from Copilot September 22, 2026 12:00

@gdziadkiewicz gdziadkiewicz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, asked Copilot to also take a look

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Two critical reconfiguration lifecycle issues remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 High severity

Open (2)
What changed in this PR

Fixes appender file-lock overlap during XML reconfiguration by deferring activation until logger swaps complete.

Changes:

  • Defers pending appender activation.
  • Adds close-before-open regression coverage.
  • Updates changelog references and test guidance.
File Summary
src/​log4net/​Repository/​Hierarchy/​XmlHierarchyConfigurator.cs Defers activation; two critical issues remain regarding activation-failure handling and premature publication.
src/​log4net.Tests/​Config/​XmlConfiguratorReconfigurationTest.cs Verifies outgoing appenders close before replacements open.
src/​changelog/​3.5.0/​321-reconfiguration-appender-overlap.xml Documents the reconfiguration fix.
src/​changelog/​3.5.0/​320-centralize-npm-dependencies.xml Corrects the related pull request reference.
CLAUDE.md Documents temporary-folder test usage.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs Outdated
Comment thread src/log4net/Repository/Hierarchy/XmlHierarchyConfigurator.cs
- deferring ActivateOptions moved it out of the ParseAppender catch
- the failure is logged and the appender detached and closed
- children are unwired first, so a container does not take them down
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File lock error when using FileAppender with XmlConfigurator.ConfigureAndWatch (v3.3.1)

4 participants