GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix race in Hierarchy.TryCreateLogger by gdziadkiewicz · Pull Request #294 · apache/logging-log4net

Conversation

@gdziadkiewicz

@gdziadkiewicz gdziadkiewicz commented May 8, 2026

Copy link
Copy Markdown
Contributor

This PR adds the regression (compared to log4net version 2) test case from #292 and fix in form of bringing back lock in Hierarchy.TryCreateLogger that is used to synchronize creation and registering of new Loggers. Prior to the change it was possible to get an unregistered logger that will result in dropped messages.

Resolves #292

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gdziadkiewicz and others added 6 commits April 22, 2026 21:01
@gdziadkiewicz
Add the repro project from apache#292
d9cb524
@gdziadkiewicz
Add the repro for apache#292 as test
d032f46
@gdziadkiewicz
Add dotted logers tests and GetCurrentLoggers tests
3a4eee5
Co-authored-by: Copilot <[email protected]>
@gdziadkiewicz
Use one lock approach and add marker interface
3fd4b31
@gdziadkiewicz
Implement TODOs
912474a
@gdziadkiewicz
Fix mistaken in if -> switch refactor and adjust test for scenario wi…
82ee29e
…th locking
@gdziadkiewicz gdziadkiewicz self-assigned this May 8, 2026
@gdziadkiewicz
PR upgrades
e279102
@gdziadkiewicz

gdziadkiewicz commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

Two of the new tests are on the slow list :

  1. log4net.Tests.Hierarchy.LoggingConcurrencyTest.GetLogger_UnderHighConcurrency_ShouldNotLoseMessages (2.56 s)
  2. log4net.Tests.Hierarchy.LoggingConcurrencyTest.GetLogger_WithDottedNamesUnderHighConcurrency_ShouldNotLoseMessages (2.13 s)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gdziadkiewicz
gdziadkiewicz marked this pull request as ready for review May 8, 2026 07:39
@gdziadkiewicz
gdziadkiewicz requested review from FreeAndNil and Copilot May 8, 2026 07:39
Copilot started reviewing on behalf of gdziadkiewicz May 8, 2026 07:40
View session
Copilot AI reviewed May 8, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Pull request overview

This pull request addresses a concurrency regression in Hierarchy.GetLogger(...) where concurrent logger creation could return an unregistered Logger, causing events to be dropped. It restores synchronization around logger creation/registration and adds regression tests based on the reproduction in #292.

Changes:

  • Reintroduces a lock in Hierarchy.TryCreateLogger to serialize logger creation + registration, avoiding returning partially registered loggers.
  • Introduces an internal IHierarchyNode marker so the logger map can store either Logger or ProvisionNode in a type-safe way.
  • Adds concurrency and repository enumeration regression tests, including cases with dotted logger names and failure scenarios in the logger-creation event.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/log4net/Repository/Hierarchy/ProvisionNode.cs Adds IHierarchyNode and implements it for ProvisionNode to support typed storage in the hierarchy map.
src/log4net/Repository/Hierarchy/Logger.cs Implements IHierarchyNode on Logger to unify dictionary value types.
src/log4net/Repository/Hierarchy/Hierarchy.cs Fixes the race by locking around logger creation/registration and updates hierarchy node handling to use IHierarchyNode.
src/log4net.Tests/Hierarchy/LoggingConcurrencyTest.cs Adds regression tests to validate no message loss and correct blocking behavior during concurrent logger creation/registration.
src/log4net.Tests/Hierarchy/HierarchyTest.cs Adds tests ensuring GetCurrentLoggers() behavior (empty, includes created, excludes root, excludes provision nodes).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/log4net/Repository/Hierarchy/Hierarchy.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/log4net.Tests/Hierarchy/LoggingConcurrencyTest.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

gdziadkiewicz and others added 2 commits May 9, 2026 14:59
@gdziadkiewicz
Potential fix for pull request finding
07a5fe3
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@gdziadkiewicz
PR upgrades 2
18405c4
@gdziadkiewicz gdziadkiewicz mentioned this pull request May 9, 2026
#292 fix race in try create logger gdziadkiewicz/logging-log4net#4
Closed
FreeAndNil
FreeAndNil approved these changes May 9, 2026
View reviewed changes

@FreeAndNil FreeAndNil left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks a lot.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@FreeAndNil FreeAndNil mentioned this pull request May 9, 2026
Log messages not getting to appender during concurrent GetLogger #292
Closed
@gdziadkiewicz
gdziadkiewicz merged commit 44e9c13 into apache:master May 9, 2026
3 checks passed

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Jun 26, 2026
Bump the nuget-dependencies group with 8 updates SvenGroot/JumboCore#37
Closed
Bump log4net and 8 others SvenGroot/JumboCore#38
Closed
Bump log4net from 3.3.1 to 3.3.2 UnderminersTeam/UndertaleModTool#2408
Merged
Bump log4net from 3.3.1 to 3.3.2 ParadoxGameConverters/PGCG.commonItems#871
Merged
Bump log4net from 3.3.1 to 3.3.2 loresoft/KickStart#293
Merged
Bump log4net from 2.0.8 to 3.3.2 strobes-test/MkartLogistics#50
Open
Bump the nuget-minor-and-patch group with 1 update filmliga66/drive-mapper#13
Merged
Bump log4net from 3.3.1 to 3.3.2 OPCFoundation/UA-EdgeTranslator#82
Merged
Bump log4net from 3.3.1 to 3.3.2 overdrive1708/FastFileReadonly#9
Merged
Bump log4net from 3.3.0 to 3.3.2 rogerbriggen/aspire_otel_test#79
Merged
This was referenced Oct 12, 2026
Bump log4net and 11 others SvenGroot/JumboCore#67
Closed
Bump the nuget-dependencies group with 13 updates SvenGroot/JumboCore#68
Closed
Bump the nuget-dependencies group with 13 updates SvenGroot/JumboCore#69
Closed
Bump log4net and 11 others SvenGroot/JumboCore#70
Closed
Bump the nuget-dependencies group with 14 updates SvenGroot/JumboCore#71
Closed
This was referenced Oct 20, 2026
Bump the nuget-dependencies group with 14 updates SvenGroot/JumboCore#72
Closed
Bump Crc32.NET and 12 others SvenGroot/JumboCore#73
Closed
Bump the nuget-dependencies group with 14 updates SvenGroot/JumboCore#74
Closed
Bump Crc32.NET and 12 others SvenGroot/JumboCore#75
Closed
Bump the minor-and-patch group with 6 updates digst/OIOSAML.Net#91
Closed
Bump the minor-and-patch group with 1 update digst/OIOSAML.Net#99
Merged
This was referenced Oct 30, 2026
Bump log4net from 2.0.8 to 3.5.0 devsecops-lab-luis/demo-ghas-multilenguaje#12
Closed
nuget: Bump the nuget-dependencies group with 52 updates hardolf/JRiver.MediaCenter#46
Closed
This was referenced Nov 11, 2026
Bump the nuget-dependencies group with 14 updates SvenGroot/JumboCore#76
Closed
Bump Crc32.NET and 12 others SvenGroot/JumboCore#77
Closed
Bump log4net from 3.2.0 to 3.5.0 marcmy/ProtonVPN-win-app#153
Closed
Dependency (dependabot/nuget): Bump log4net from 3.2.0 to 3.5.0 sg-scale/NETworkManager--2025.10.18.0#10
Open
Bump the nuget-dependencies group with 14 updates SvenGroot/JumboCore#78
Closed
Bump Crc32.NET and 12 others SvenGroot/JumboCore#79
Closed
Bump log4net from 3.3.0 to 3.5.0 chutch3/kenku#87
Merged
Bump log4net from 2.0.15 to 3.6.0 sg-scale/NETworkManager--2022.12.20.0#5
Open
Bump Crc32.NET and 12 others SvenGroot/JumboCore#80
Closed
Bump the nuget-dependencies group with 14 updates SvenGroot/JumboCore#81
Closed
Bump log4net from 3.3.1 to 3.6.0 bbtsoftware/AzureDevOpsPolicyConfigurator#255
Open
Bump log4net from 2.0.8 to 3.6.0 devsecops-lab-luis/demo-ghas-multilenguaje#27
Open
Dependency (dependabot/nuget): Bump log4net from 3.3.0 to 3.6.0 Nevergoodstudy/NETworkManager-macOS#24
Open
Bump the nuget-dependencies group with 14 updates SvenGroot/JumboCore#82
Open
Bump Crc32.NET and 12 others SvenGroot/JumboCore#83
Open
Bump log4net from 3.3.1 to 3.6.0 bNobo/needabreak#176
Open
@dependabot dependabot Bot mentioned this pull request Nov 24, 2026
Bump Crc32.NET and 12 others SvenGroot/JumboCore#84
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@FreeAndNil FreeAndNil FreeAndNil approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@gdziadkiewicz gdziadkiewicz

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Log messages not getting to appender during concurrent GetLogger

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@gdziadkiewicz @FreeAndNil
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.