Skip to content

Incorrect Logging Level for JSON Format Errors in POST Requests #56227

@KrzysztofPajak

Description

@KrzysztofPajak

Description:

When sending a POST request with an incorrectly formatted JSON body (e.g., containing only the character '}'), the error details are logged with a Level = Debug. This logging level seems inappropriate for this type of error, and it should be logged with Level = Error instead.

Steps to Reproduce:

  1. Send a POST request to the API endpoint with a malformed JSON body. For example:
    }
    Observe the logs generated by the application.

Expected Behavior:

The application should log the details of the error with a logging level of Error.

Actual Behavior:

The error details are logged with a logging level of Debug.

Environment:

ASP.NET Core Version: 8.0
Operating System: Windows 11

Additional Information:

Logging critical errors such as malformed JSON requests at a Debug level can obscure important issues that should be promptly addressed. Adjusting the logging level to Error will ensure these issues are more visible to developers and system administrators.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesdesign-proposalThis issue represents a design proposal for a different issue, linked in the description

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions