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

serilog log different format between .net core 6 and .net core 8 for http sink #390

Closed
KamranShahid opened this issue Sep 11, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@KamranShahid
Copy link

KamranShahid commented Sep 11, 2024

I am using http sink of serilog. previously my logs was sent to my http log end point like following

  {
     "events": [
       {
         "Timestamp": "2024-09-11T13:22:00.8350743+01:00",
         "Level": "Information",
         "MessageTemplate": "User profile is available. Using '{FullName}' as key repository and Windows DPAPI to encrypt keys at rest.",
         "RenderedMessage": "User profile is available. Using '\"C:\\Users\\kamran.shahid\\AppData\\Local\\ASP.NET\\DataProtection-Keys\"' as key repository and Windows DPAPI to encrypt keys at rest.",
         "Properties": {
           "FullName": "C:\\Users\\kamran.shahid\\AppData\\Local\\ASP.NET\\DataProtection-Keys",
           "EventId": {
             "Id": 63,
             "Name": "UsingProfileAsKeyRepositoryWithDPAPI"
           },
           "SourceContext": "Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager"
         }
         ]
    }

now after updating my project to .net 8 my logs are sending in this format

    [
      {
        "Timestamp": "2024-09-11T12:10:51.2656227Z",
        "Level": "Information",
        "MessageTemplate": "User profile is available. Using '{FullName}' as key repository and Windows DPAPI to encrypt keys at rest.",
        "RenderedMessage": "User profile is available. Using '\"C:\\Users\\kamran.shahid\\AppData\\Local\\ASP.NET\\DataProtection-Keys\"' as key repository and Windows DPAPI to encrypt keys at rest.",
        "Properties": {
          "FullName": "C:\\Users\\kamran.shahid\\AppData\\Local\\ASP.NET\\DataProtection-Keys",
          "EventId": {
            "Id": 63,
            "Name": "UsingProfileAsKeyRepositoryWithDPAPI"
          },
          "SourceContext": "Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager"
        }
      }
    ]

any idea what could be wrong

Problem seems to be in http sink version after 7.2.0 version.
9.0.0, 8.0.0 all having this problem

@KamranShahid KamranShahid added the bug Something isn't working label Sep 11, 2024
Copy link
Contributor

Hi there and welcome to this repository!

A maintainer will be with you shortly, but first and foremost I would like to thank you for taking the time to report this issue. Quality is of the highest priority for us, and we would never release anything with known defects. We aim to do our best but unfortunately you are here because you encountered something we didn't expect. Lets see if we can figure out what went wrong and provide a remedy for it.

@KamranShahid KamranShahid changed the title serilog log different fomat between .net core 6 and .net core 8 for http sink serilog log different format between .net core 6 and .net core 8 for http sink Sep 11, 2024
@FantasticFiasco
Copy link
Owner

What you experience is a breaking changed introduced in Serilog.Sinks.Http v.8.0.0. See #178 in the release notes (also mentioned in CHANGELOG.md).

@KamranShahid
Copy link
Author

Thanks @FantasticFiasco ,
I found out more details at https://stackoverflow.com/questions/78973968/serilog-log-different-format-between-net-core-6-and-net-core-8-for-http-sink

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants