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

EventId duplication #141

Closed
Sirozha1337 opened this issue May 11, 2021 · 3 comments
Closed

EventId duplication #141

Sirozha1337 opened this issue May 11, 2021 · 3 comments

Comments

@Sirozha1337
Copy link

When logging messages like this:
logger.LogError(new EventId(1, "Test"), "some message")
The following Json object gets logged in ElasticSearch:

{
   "level": "Error",
   "message": "some message",
   "EventId_Id": 1,
   "EventId_Name": "Test",
   "EventId": {
       "Id": 1,
       "Name": "Test"
   }
}

The same information about the event gets logged twice.

Is this a bug or the intended behaviour?

@snakefoot
Copy link
Collaborator

snakefoot commented May 11, 2021

It is caused by NLog.Extensions.Logging, that captures the EventId many times:

  • EventId - The entire object
  • EventId_Id - The EventId-Id-property
  • EventId_Name - The EventId-Name-property

The goal is to remove EventId-property, since it will actually introduces additional boxing overhead, but is a breaking change and waiting for NLog 5.0. See also: NLog/NLog.Extensions.Logging#319

The ElasticSearch-Target has the option ExcludedProperties that might be useful until getting to NLog 5.0 RTM.

@Sirozha1337
Copy link
Author

@snakefoot thanks for the quick response. I used the ExcludedProperties option to remove duplicated fields.
Should I close this issue or will you close it when it gets fixed by NLog team?

@snakefoot
Copy link
Collaborator

snakefoot commented May 12, 2021 via email

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

No branches or pull requests

2 participants