Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Fixed errors not logging to SelfLog #284

Conversation

TooLazyToMakeAName
Copy link

What issue does this PR address?
Elasticsearch error messages not logged to selflog. #280

Does this PR introduce a breaking change?
No.

Please check if the PR fulfills these requirements

  • The commit follows our guidelines
  • Unit Tests for the changes have been added (for bug fixes / features)

@@ -72,7 +72,7 @@ protected override void EmitBatch(IEnumerable<LogEvent> events)
var items = result.Body["items"];
foreach (var item in items)
{
if (item["index"] != null && HasProperty(item["index"], "error") && item["index"]["error"] != null)
Copy link
Contributor

Choose a reason for hiding this comment

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

The HasProperty function is not used now anymore. Would it be possible to include the ContainsKey functionality inside the HasProperty function instead? In order to make that one more robust?
Is there any way to test this BTW? So does it not break now for the other versions of EF?

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. It should suffice to change the first condition of HasProperty from if (settings is System.Dynamic.ExpandoObject) to if (settings is System.Collections.IDictionary || settings is System.Dynamic.ExpandoObject).

I believe item isn't always an IDictionary, in fact I think I tried .ContainsKey first and it didn't work for me because it was some other kind of dynamic object.

No idea about how to integration test this, unfortunately. Unit testing the HasProperty function would be trivial of course but wouldn't help at all with ES version changes.

@ffMathy
Copy link
Contributor

ffMathy commented Oct 24, 2019

@TooLazyToMakeAName can't wait to have this corrected and merged - thank you.

@kierseFG
Copy link

I too am affected by this issue and would love to see this fix get through. @mivano if @TooLazyToMakeAName is MIA for much longer I am willing to take this over and push it across the finish line.

@mivano
Copy link
Contributor

mivano commented Mar 15, 2020

Please do, I m not using the sink itself, so anybody that can provide some help to indicate that this is a needed change is more than welcome.

@ffMathy
Copy link
Contributor

ffMathy commented Jun 26, 2020

Any progress?

@mivano
Copy link
Contributor

mivano commented Jul 7, 2020

Sorry, nothing from me. Not actively using the sink at the moment. If someone can pick this up and validate that this is working as desired, we can merge it in.

@mivano
Copy link
Contributor

mivano commented Sep 16, 2020

I think with another PR, this might not be needed anymore?

@mivano
Copy link
Contributor

mivano commented Jan 29, 2023

Too much drift, other changes got in as well. So closing this one.

@mivano mivano closed this Jan 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants