microsoft / ApplicationInsights-Profiler-AspNetCore

Application Insights Profiler sample and documentation
MIT License
66 stars 24 forks source link

Application is starting and shutting down messages written when using profiler. #128

Closed xcellsoft closed 3 years ago

xcellsoft commented 3 years ago

Since enabling the profiler in a dotnet 3.1.5 I see multiple messages throughout the day indicating the application is shutting down and starting up. The shutdown always appears after the Service Profiler trace uploaded message and the startup comes before.

The application is not shutting down or starting up so I am at a loss why these appear and obviously its a concerning message in our production environment.

Any insight would be appreciated.

snippet from log where the erroneous messages appear.

info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Production
info: Microsoft.Hosting.Lifetime[0]
      Content root path: D:\Qualexio\Omnicore\Src\Qualex.OmniCore.Main
Application Insights Telemetry: {"name":"AppMetrics","time":"2021-01-29T15:04:31.8087422Z",...
Application Insights Telemetry: {"name":"AppMetrics","time":"2021-01-29T15:04:31.8118065Z",...
Application Insights Telemetry: {"name":"AppMetrics","time":"2021-01-29T15:04:31.8152583Z",...
info: Microsoft.ApplicationInsights.Profiler.Uploader.TraceUploader[0]
      Service Profiler trace uploaded.
info: Microsoft.Hosting.Lifetime[0]
      Application is shutting down...
xiaomi7732 commented 3 years ago

@xcellsoft Thanks for filing the issue. Could you please give us more info about the application for troubleshooting:

Those info will help us come up troubleshoot strategies. Thanks!

xcellsoft commented 3 years ago
xiaomi7732 commented 3 years ago

@xcellsoft, Oh~ I see what you are seeing now. It is totally normal because that is the Uploader's exiting. It is not from your application. It is a level of info logs for the Uploader process - we switched to generic hosted application for the uploader in the recent versions. And that is is revealing the fact the uploader finished running and quits - which is why your application wasn't impacted.

Do you feel that annoying? Do you think it the best we hide the info level of messages from uploader?

xcellsoft commented 3 years ago

It is very concerning in my opinion to see that message in your production logs (I had a shock moment at first) as we expect those logs to be very clean especially when logging is set to Warning and you see messages in there you assume they are warnings or errors not info from a secondary process.

Yes, I really feel these messages should be suppressed.

Also, it fills up the logs with erroneous data making it more difficult to find/read real warnings/errors.

Do you know which version this is resolved in? I wouldn't have a problem updating in the 3.5 version line, still holding off a little on 5 to give it some time to be fleshed out a little more.

xiaomi7732 commented 3 years ago

Hey @xcellsoft, the issue is not in .NET Core runtime, it is in this package. I'll issue an fix for suppress the loggings from the uploader, and it will released in the next version - 2.2.0-beta7, supposedly. And you will have to update the reference to Microsoft.ApplicationInsights.Profiler.AspNetCore to that version. I'll close this issue once the package is released.

xcellsoft commented 3 years ago

Sounds good, thanks for the quick turn around.

xiaomi7732 commented 3 years ago

New package released. Please check it out: https://www.nuget.org/packages/Microsoft.ApplicationInsights.Profiler.AspNetCore/2.2.0-beta7