Skip to content

Structured log in HttpLoggingMiddleware #33086

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

Merged
merged 1 commit into from
May 28, 2021

Conversation

Kahbazi
Copy link
Member

@Kahbazi Kahbazi commented May 27, 2021

Fixes #33038

@ghost ghost added area-runtime community-contribution Indicates that the PR has been added by a community member labels May 27, 2021
@Tratcher Tratcher requested a review from wtgodbe May 27, 2021 22:23
@wtgodbe
Copy link
Member

wtgodbe commented May 27, 2021

This addresses #33038 in practice, but I'm not sure it does in spirit - we're still concatenating the objects to strings in the middleware, so logger implementations still don't have access to the original objects - @davidfowl do we think that's a goal here?

@Tratcher
Copy link
Member

Tratcher commented May 27, 2021

HttpRequestLog has the list of individual objects, though I think AddToList needs to be changed from string? to object? as well. What objects aren't strings to begin with?

@wtgodbe
Copy link
Member

wtgodbe commented May 27, 2021

At least HttpRequest.QueryString is not a string:

if (options.LoggingFields.HasFlag(HttpLoggingFields.RequestQuery))
{
AddToList(list, nameof(request.QueryString), request.QueryString.Value);
}

@Tratcher
Copy link
Member

It's mostly a string 😁. Passing the wrapper object preserves a little context. the same for Path. Anything else?

@wtgodbe
Copy link
Member

wtgodbe commented May 27, 2021

There are some I'm adding in W3C, but I can handle those after this is in (Cookie, Query)

@davidfowl
Copy link
Member

Yes this is fine.

@davidfowl davidfowl merged commit ac81287 into dotnet:main May 28, 2021
@ghost ghost added this to the 6.0-preview6 milestone May 28, 2021
@Kahbazi Kahbazi deleted the kahbazi/httpLoggingStructured branch May 28, 2021 08:38
@amcasey amcasey added area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares and removed area-runtime labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-middleware Includes: URL rewrite, redirect, response cache/compression, session, and other general middlewares community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use structured log properties in HTTP logging middleware
5 participants