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

Show that ApplicationInsightsLoggerProvider defaults to Warning only if there is no config #2610

Open
mikeblakeuk opened this issue Jun 14, 2022 · 7 comments

Comments

@mikeblakeuk
Copy link

mikeblakeuk commented Jun 14, 2022

logger.LogWarning("Response from bing is:" + res); // this will be captured by Application Insights.

show that
logger.LogInformation("not logged");

@cijothomas
Copy link
Contributor

Not sure what exactly you meant. There is no defaults by ApplicationInsightsLoggerProvider in a console app. Whatever is the configuration for the application, is applied to ApplicationInsightsLoggerProvider, just like any other provider.

@mikeblakeuk
Copy link
Author

If you don't have a config, and try to logger.LogInfo, it won't log to App insights.

This is due to https://github.com/microsoft/ApplicationInsights-dotnet/blob/main/NETCORE/src/Shared/Extensions/ApplicationInsightsExtensions.cs#L427

@cijothomas
Copy link
Contributor

Thanks for clarifying. Its already covered in the docs : https://docs.microsoft.com/en-us/azure/azure-monitor/app/worker-service , but would be nice to mention in the examples in this repo too.

@LockTar
Copy link

LockTar commented Nov 16, 2022

Thanks for clarifying. Its already covered in the docs

To be more specific. It is documented here:
https://learn.microsoft.com/en-us/azure/azure-monitor/app/worker-service#ilogger-logs
and in the C# log warning example lines.

logger.LogWarning("A sample warning message. By default, logs with severity Warning or higher is captured by Application Insights");

@mikeblakeuk
Copy link
Author

It would be nice if there was a line under it
logger.LogInformation("Lower than Warning is not logged if detaults are used");
to help developers who get the sample, add info logs and then look for them.

@github-actions
Copy link

This issue is stale because it has been open 300 days with no activity. Remove stale label or this will be closed in 7 days. Commenting will instruct the bot to automatically remove the label.

@github-actions github-actions bot added the stale label Sep 13, 2023
@mikeblakeuk
Copy link
Author

Could the Info be added?

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

3 participants