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

Access Token Log Not Formatted Correctly #1328

Closed
1 task done
randellhodges opened this issue Dec 9, 2023 · 1 comment
Closed
1 task done

Access Token Log Not Formatted Correctly #1328

randellhodges opened this issue Dec 9, 2023 · 1 comment
Assignees
Labels
area: framework ⚙ Changes in the SDK core framework code question Further information is requested

Comments

@randellhodges
Copy link

randellhodges commented Dec 9, 2023

Category

  • Bug

Describe the bug

The access token log entry looks like it isn't formatted correctly.

Text:
image

JSON:
image

It seems like 0 and 2 are backwards (maybe this is a Serilog problem?) and the scope needs the leading ", " trimmed.

Code in question:

// Log the access token retrieval action
Log?.LogInformation(PnPCoreAuthResources.AuthenticationProvider_LogAccessTokenRetrieval,
GetType().Name, resource, scopes.Aggregate(string.Empty, (c, n) => c + ", " + n).TrimEnd(','));

Steps to reproduce

  1. Use Serilog
  2. Use Certificate Authentication
  3. Set log for Information

Environment details (development & target environment)

  • SDK version: 1.10.0
  • OS: Windows
  • SDK used in: Net Core 6 Web Api
  • Framework: .Net Core 6
  • Tooling: Visual Studio 2022

Additional context

Secondary question: Can we have a way to turn off those messages? I still want to leave the log level for Information because I need to watch for throttling messages and other things, but my logs are flooded with these access token entries. Maybe some sort of property on the PnpCoreAuthenticationOptions?

@jansenbe jansenbe added question Further information is requested area: framework ⚙ Changes in the SDK core framework code labels Dec 9, 2023
jansenbe added a commit that referenced this issue Jan 2, 2024
@jansenbe jansenbe self-assigned this Jan 2, 2024
@jansenbe
Copy link
Contributor

jansenbe commented Jan 2, 2024

@randellhodges : the ordering is seems to be something with Serilog. When we bump serilog versions this might get fixed, but don't see this a breaking thing.

Regarding the default log level for the "access token" messages you've a point. I changed those to default to debug level.

Changes will appear in the next nightly.

@jansenbe jansenbe closed this as completed Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: framework ⚙ Changes in the SDK core framework code question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants