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

added specific ApplicationInsightsLoggerOptions to configure logging #574

Merged
merged 7 commits into from
Mar 19, 2018

Conversation

funkycoding
Copy link
Contributor

@funkycoding funkycoding commented Dec 14, 2017

PR #483 (belongs to issue #393) was made to send ExceptionTelemetry when the exception parameter of public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter) is not null.

This introduced some side effects in, for example, entity framework core. They log an exception using ILogger and then re-throw the exception to be (possibly) handled by the consumer. If the consumer then also logs that exception, we get double entries. I understand that ApplicationInsights wants to track as much as possible with less work but this introduced some quirks.

This PR proposes to introduce a ApplicationInsightsLoggerOptions to allow for some customization. I've tried to leave the public surface intact as much as possible and it defaults to the way it currently works.

Secondly, i haven't changed the overloads in ApplicationInsightsLoggerFactoryExtensions, because i'm not 100% sure how you guys would like to see this 😄

For significant contributions please make sure you have completed the following items:

  • Changes in public surface reviewed
  • The PR will trigger build, unit test, and functional tests automatically. If your PR was submitted from a fork - mention one of committers to initiate the build for you.

@msftclas
Copy link

msftclas commented Dec 14, 2017

CLA assistant check
All CLA requirements met.

@funkycoding
Copy link
Contributor Author

@cijothomas ping :) Not sure if i had to include you in here...

@cijothomas
Copy link
Contributor

@funkycoding Thanks a lot for your contribution! And apologies for not responding quickly to the issues in this repo. We'll be more actively monitoring this repo going forward.

I am not sure whether you saw this https://github.com/Microsoft/ApplicationInsights-aspnetcore/pull/570/files, but this one also introduces the notion of ApplicationInsightsLoggerOptions .
I am reviewing the other PR now, and will ask author for couple changes. Please wait till that is completed and make neccessary changes here, and we'll merge this one as well.

(If i dont hear from PR author's in couple days I'll try to merge both into a single one myself)

@funkycoding
Copy link
Contributor Author

funkycoding commented Mar 5, 2018

@cijothomas ok! I'll await the feedback (and occasionally look to see if i can merge / implement feedback).

@cijothomas
Copy link
Contributor

@funkycoding The other PR I mentioned is in now. Can you adjust yours to take that into account?
Also update chagelog.md as well!
Thanks!

@funkycoding
Copy link
Contributor Author

@cijothomas I've merged latest develop into my (local) repo, but the test project doesn't seem to work now. Hang in there...

@funkycoding
Copy link
Contributor Author

@cijothomas Everything builds locally. I'm able to run the Microsoft.ApplicationInsights.AspNetCore.Tests tests (although, only through cmd/powershell). I noticed that the build failed. What can i do?

@d3r3kk
Copy link
Contributor

d3r3kk commented Mar 12, 2018

@funkycoding A transient error occurred in our build pipeline - we can simply queue a new build to sort it out.
Simply close, and then re-open, this PR.

@funkycoding funkycoding reopened this Mar 13, 2018
@d3r3kk
Copy link
Contributor

d3r3kk commented Mar 13, 2018

Perhaps this isn't such a transient error. I'll see if I can sort it out sometime today. Apologies!

@cijothomas cijothomas merged commit fff398a into microsoft:develop Mar 19, 2018
@cijothomas
Copy link
Contributor

Thanks Derek for helping here.
The transient failures are not related to this PR, - So I am merging this. (thanks @funkycoding for your contribution)

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.

4 participants