Skip to content

Add custom format support to HttpLogging middleware #46989

Open

Description

In production i want to log each http request in the format I select. With HttpLogging I can selected Headers and LoggingFields but I cannot format the result, which looks something like this.

image

I need to be able create single line logs and reorder logged properties

Describe the solution you'd like

In HttpLoggingOptions I would like to be able to specify string format. It would look something like this:

builder.Services.AddHttpLogging(options =>
{
    options.LogFormat = "Protocol {HttpProtocol} Scheme: {RequestScheme} \n Path: {Path}";
});

Additional context

No response

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

Metadata

Assignees

No one assigned

    Labels

    area-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middleswarefeature-diagnosticsDiagnostic middleware and pages (except EF diagnostics)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions