serilog-contrib / serilog-sinks-applicationinsights

A Serilog sink that writes events to Microsoft Azure Application Insights
Apache License 2.0
220 stars 72 forks source link

Update README.md with setup instructions after TelemetryConfiguration.Active was deprecated #160

Closed dglozano closed 3 years ago

dglozano commented 3 years ago

After going through the thread #121 in order to be able to configure the Sink properly, I thought it might be useful to update the README.md with the instructions on how to set the logger in .NET Core applications after TelemetryConfiguration.Active was deprecated 😄

vany0114 commented 3 years ago

I ran into the same issue the only difference is that I'm using this extension from a Generic Host, so the AddApplicationInsightsTelemetry does not work in that scenario, you should use AddApplicationInsightsTelemetryWorkerService from Microsoft.ApplicationInsights.WorkerService. So would be nice to add it to the documentation too, I can do it if you want me to do so.

dglozano commented 3 years ago

@vany0114 not sure if instructions to setup ApplicationInsights itself would belong in the Serilog's sink documentation, but I guess it doesn't hurt either 😄 Feel free to add it

vany0114 commented 3 years ago

@dglozano I think would be nice just to mention that if you're using a Generic Host you need to use AddApplicationInsightsTelemetryWorkerService rather than AddApplicationInsightsTelemetry (Asp.Net projects) otherwise it does not work, just for the benefit of everyone who runs into that issue (I spent a couple of hours on that)

vany0114 commented 3 years ago

FYI https://github.com/dglozano/serilog-sinks-applicationinsights/pull/1

dglozano commented 3 years ago

@vany0114 sorry for the delay, it's merged now 😄

sonic1981 commented 3 years ago

This information really need merging in