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

[Feature Request] Authentication logging #821

Closed
mtanml opened this issue Dec 7, 2020 · 10 comments
Closed

[Feature Request] Authentication logging #821

mtanml opened this issue Dec 7, 2020 · 10 comments
Assignees
Milestone

Comments

@mtanml
Copy link

mtanml commented Dec 7, 2020

Is logging available? If so, can you please point me to the documentation?

I'm looking for something like the WithLogging parameter for Microsoft Identity Client:

https://docs.microsoft.com/en-us/dotnet/api/microsoft.identity.client.abstractapplicationbuilder-1.withlogging?view=azure-dotnet

Thanks

@mtanml mtanml added the enhancement New feature or request label Dec 7, 2020
@jennyf19 jennyf19 added answered question Further information is requested labels Dec 8, 2020
@jennyf19
Copy link
Collaborator

jennyf19 commented Dec 8, 2020

@mtanml we integrate with the asp net core logs, which you can set up in the appsettings, more information here and more on configuring logging.

@mtanml
Copy link
Author

mtanml commented Dec 8, 2020

@jennyf19 thanks for the info! I was able to enable logging, but is there a way to limit the logs to authentication info? And I'm not seeing the level of detail that we get with Microsoft Identity Client (token acquisition/exchange, etc.) We use this info to troubleshoot user logins. Thanks!

@jennyf19
Copy link
Collaborator

jennyf19 commented Dec 8, 2020

@mtanml I understand. we do not hook up to the MSAL logs. So, yes, that would be a feature request.
cc: @jmprieur

@jmprieur jmprieur added this to the 1.4.1 milestone Dec 8, 2020
@jmprieur jmprieur removed answered question Further information is requested labels Dec 8, 2020
@jennyf19 jennyf19 self-assigned this Dec 9, 2020
@jennyf19
Copy link
Collaborator

@mtanml i have a branch w/ an initial commit to enable the MSAL .NET logs, but if you have suggestions or feedback on the developer experience, that would be much appreciated.

In appsettings.json, you would need to do the following in the AzureAD section:

 "EnableMsalPiiLogs": true, // set to false by default, so not necessary
 "LogLevel": "Info" //MSAL .NET includes "Info" "Warning" "Verbose" and "Error" logging options

I did the following to see the MSAL .NET logs in the console, but i'm sure you have something more interesting:

"Logging": {
        "LogLevel": {
            "Default": "Information",
            "Microsoft": "Warning",
            "Microsoft.Hosting.Lifetime": "Information"
        },
        "Console": {
            "LogLevel": {
                "Default": "Information"
            }
        }

cc: @jmprieur

@mtanml
Copy link
Author

mtanml commented Dec 10, 2020

@jennyf19 I won't have time to do any testing soon, but I really appreciate the super-fast work on this! In our project that implements Microsoft.Identity.Client we use a method with the following parameters to capture authentication log info and write it to our database. As long as we'd be able to do the same in Microsoft.Identity.Web, then you have met our needs. Thanks a million!

private static void Log(Microsoft.Identity.Client.LogLevel level, string message, bool containsPii)

@jennyf19
Copy link
Collaborator

jennyf19 commented Dec 14, 2020

@mtanml we've changed a few things from the initial branch, so here is the info on logging in the wiki and we'll get this out in the next release. if you want to try it out, the changes have been merged to master.

@mtanml
Copy link
Author

mtanml commented Dec 14, 2020

Excellent, thank you @jennyf19 !

@jennyf19
Copy link
Collaborator

@mtanml we will get this in 1.4.1 release, which will probably be tomorrow (12.15)

@jennyf19
Copy link
Collaborator

@mtanml Included in 1.4.1 release

@mtanml
Copy link
Author

mtanml commented Dec 15, 2020

@jennyf19 I was just about to write you... works like a charm :)

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants