This repository was archived by the owner on Dec 19, 2025. It is now read-only.
[ADMINAPI-1322] Double logging in the RequestLoggingMiddleware#376
Merged
DavidJGapCR merged 2 commits intomainfrom Nov 10, 2025
Merged
[ADMINAPI-1322] Double logging in the RequestLoggingMiddleware#376DavidJGapCR merged 2 commits intomainfrom
DavidJGapCR merged 2 commits intomainfrom
Conversation
… logger mechanism
Test Results338 tests 337 ✅ 15s ⏱️ Results for commit a13213c. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors logging initialization by extracting inline log4net configuration code from Program.cs into a dedicated AddLoggingServices extension method in WebApplicationBuilderExtensions.cs. This improves code organization and maintainability by consolidating logging setup logic.
Key changes:
- Extracted log4net initialization code from
Program.csinto newAddLoggingServicesextension method - Added clearing of default logging providers to prevent duplicate logging
- Consolidated all logging configuration in one location for better maintainability
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| Application/EdFi.Ods.AdminApi/Program.cs | Replaced inline log4net initialization with call to AddLoggingServices() extension method |
| Application/EdFi.Ods.AdminApi/Infrastructure/WebApplicationBuilderExtensions.cs | Added new AddLoggingServices method containing log4net initialization logic, including clearing default providers and configuring log4net |
Application/EdFi.Ods.AdminApi/Infrastructure/WebApplicationBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
DavidJGapCR
approved these changes
Nov 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
This pull request refactors how logging is configured and initialized in the application, specifically focusing on log4net setup. The main improvement is the encapsulation of logging initialization logic into a dedicated extension method, which simplifies and standardizes logging configuration throughout the application. Additionally, some redundant code is removed to streamline the startup process.
Logging configuration refactor:
Program.csinto a new extension methodAddLoggingServicesinWebApplicationBuilderExtensions.cs, improving code organization and reusability. [1] [2]AddLoggingServicesmethod clears all default logging providers, initializes log4net early based on configuration, and adds log4net as the logging provider, ensuring consistent logging setup.Code cleanup:
AddServicesmethod inWebApplicationBuilderExtensions.cs, preventing duplicate or conflicting logging setups.Dependency updates:
log4netandlog4net.Configusing statements to support the new logging initialization logic.