Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor serilog initialization and add module initialization logging #2871

Merged
merged 5 commits into from
Dec 24, 2024

Conversation

asvishnyakov
Copy link
Contributor

@asvishnyakov asvishnyakov commented Dec 16, 2024

Description

  1. Updated Loggin for Production mode:
    image

  2. Added module initialization and post-initialization logging. Can be enabled by this:

{
  "Serilog": {
    "MinimumLevel": {
      "Override": {
        "VirtoCommerce.Platform.Modules": "Debug"
      }
    }
  }
}

Without setting:
Platform log when setting not specified
With setting:
Platform log when setting specified

  1. Refactored Serilog registration based on

    https://github.com/serilog/serilog-aspnetcore?tab=readme-ov-file#two-stage-initialization
    https://github.com/serilog/serilog-extensions-hosting?tab=readme-ov-file#instructions

    Replaced ConsoleLog with static Serilog's Log.Logger and ILogger injection support.

    ILogger will not log any messages to Serilog during DI initialization without this changes, because previous implementation registered it at the end of DI registration, after all other services registration.

References

QA-test:

Jira-link:

Artifact URL:

Image tag:
ghcr.io/VirtoCommerce/platform:3.874.0-pr-2871-73bd-serilog-and-module-initialization-logging-73bd5596

@vc-ci
Copy link
Contributor

vc-ci commented Dec 16, 2024

Reveiw task created: https://virtocommerce.atlassian.net/browse/VCST-2477

Copy link
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

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

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.274
Timestamp: 16-12-2024T16:46:16

Copy link
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

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

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.827
Timestamp: 18-12-2024T15:26:52

Copy link
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

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

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.992
Timestamp: 19-12-2024T08:01:55

…cId` and `UrlFormat` for better guidance on deprecation.

Updated logging statements in `ServiceCollectionExtensions.cs` and `Startup.cs` to use `Log.ForContext<Startup>()` for more context-specific logging.

Adjusted logging configuration in `appsettings.Development.json` and `appsettings.Production.json` to include settings for `VirtoCommerce.Platform.Web.Startup` and modified logging levels for `VirtoCommerce.Platform.Modules`.
Copy link

Copy link
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

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

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.734
Timestamp: 19-12-2024T10:38:01

Copy link
Contributor

@vc-ci vc-ci left a comment

Choose a reason for hiding this comment

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

Test Suite: Test Suites/Modules/module_Assets
Tests: 13
Failures: 0
Errors: 0
Time: 7.913
Timestamp: 19-12-2024T10:50:43

@ekuvirto ekuvirto merged commit cba9446 into dev Dec 24, 2024
13 checks passed
@ekuvirto ekuvirto deleted the fix/serilog-and-module-initialization-logging branch December 24, 2024 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants