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

add LogLevel.None predicate to logging decision #2816

Merged
merged 7 commits into from
May 3, 2024
Merged

Conversation

westin-m
Copy link
Contributor

@westin-m westin-m commented May 2, 2024

If Logging:LogLevel:Microsoft.Identity.Web is assigned to None in appsettings.json, the default logger is not initialized and IdWeb does not record any logs.

Before, leaving the log level at Information and trying to use the no-op NullIdentityModelLogger (this decision would be ignored and the default logger would be used anyway) yielded about 500 lines of logging when launching an app and making a single API call.
Changing the log level to None still resulted in logs being recorded by the default logger, about 10 lines for the above scenario of a single API call.
Now, choosing None means the default logger is not instantiated and IdWeb logs nothing.

@westin-m westin-m requested a review from a team as a code owner May 2, 2024 19:55
@jennyf19
Copy link
Collaborator

jennyf19 commented May 2, 2024

@westin-m can you share a screenshot of the diff now?

@westin-m
Copy link
Contributor Author

westin-m commented May 2, 2024

Here is an example of seeing fewer logs from the service and client when the LogLevel for IdWeb in both is set to None. The lines highlighted in red are either omitted because the default logger is not being used, or because of the time diffs when running the app.
Service:
image

Client:
image

Copy link
Collaborator

@jmprieur jmprieur left a comment

Choose a reason for hiding this comment

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

LGTM
Thanks @westin-m

Please update the wiki on logging: https://github.com/AzureAD/microsoft-identity-web/wiki/Logging

Copy link
Collaborator

@jennyf19 jennyf19 left a comment

Choose a reason for hiding this comment

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

:shipit:

remember to add a section for the next changelog for this one...thx!

@westin-m
Copy link
Contributor Author

westin-m commented May 3, 2024

Please update the wiki on logging: https://github.com/AzureAD/microsoft-identity-web/wiki/Logging

@jmprieur Done!

@westin-m westin-m merged commit 2c6390b into master May 3, 2024
4 checks passed
@westin-m westin-m deleted the westin/logging branch May 3, 2024 00:04
@westin-m westin-m linked an issue Jun 3, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants