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

MSAL Logger Bug - Developer provided settings are overwritten by default config #1287

Open
shahzaibj opened this issue Jan 26, 2021 · 1 comment
Assignees
Labels
Bug - P2 A problem that needs to be fixed for a feature to function as intended Internal Issue created by a project contributor
Projects

Comments

@shahzaibj
Copy link
Contributor

Developer provided logger settings for the logger MAY get overwritten by our default values in some cases. Consider the following scenario:

  • A developer does NOT provide a logger config via config file such as: https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-configuration#logging
  • A developer however sets a log level on the logger using the following:
    • Logger.getInstance().setLogLevel(VERBOSE);
    • The developer calls this method prior to them even creating PublicClientApplication (as the Logger is static and not associated to PCA)
  • At this point the log level is successfully set to VERBOSE
  • Now the developer creates their PubliClientApplication.
  • During PCA creation we internally try to read the MSAL config file and set Logger Settings from there. See this method.
  • Since no developer provided config was passed, then we set the logger config based on the default config that ships with MSAL SDK located here: https://github.com/AzureAD/microsoft-authentication-library-for-android/blob/dev/msal/src/main/res/raw/msal_default_config.json
  • The default config sets the value to WARN….and therefore we end up setting log level to WARN on the logger…and in the process overwriting the VERBOSE value that was previously set by the developer using the static method.

The issue happens because Logger is a Singleton class and so when the methods to set these logging settings are called prior to the creation of a PublicClientApplication then we run into such issue. In this case we are always going to overwrite these with what is supplied either in developer provided config or the default config.

@shahzaibj shahzaibj added Bug - P2 A problem that needs to be fixed for a feature to function as intended Internal Issue created by a project contributor Issue Triage The engineering team has looked into the issue, understood the issue, labelled/classified the issue labels Jan 26, 2021
@hamiltonha hamiltonha added this to Tagged in Bug Triage Jan 29, 2021
@hamiltonha hamiltonha moved this from Tagged to Committed in Bug Triage Jan 29, 2021
@negoe negoe added the Clean up Issues created before Jan 2022 closed in bulk operation label Jul 17, 2022
@negoe negoe closed this as completed Jul 17, 2022
Bug Triage automation moved this from Committed to Closed Jul 17, 2022
@negoe negoe reopened this Sep 9, 2022
Bug Triage automation moved this from Closed to Needs triage Sep 9, 2022
@negoe
Copy link
Contributor

negoe commented Sep 9, 2022

Reopening after discussion with Shazaib.

@negoe negoe moved this from Needs triage to Investigation Required in Bug Triage Sep 26, 2022
@negoe negoe removed Issue Triage The engineering team has looked into the issue, understood the issue, labelled/classified the issue Clean up Issues created before Jan 2022 closed in bulk operation labels Oct 17, 2022
@negoe negoe moved this from Investigation Required to Enhancement in Bug Triage Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug - P2 A problem that needs to be fixed for a feature to function as intended Internal Issue created by a project contributor
Projects
Bug Triage
  
Enhancement
Development

No branches or pull requests

2 participants