You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I am trying to build a logging mechanism in my app which logs every request and response. There are many tutorials on how to do this. I think the most popular is:
Unfortunately, I think that logging request and response bodies is too complicated because both request body and response body are Streams instead of strings. Just look at this code in this article. To achieve just simple logging we have to write a lot of difficult code. This also causes other problems which are related to Streams, i.e. Large Object Heap.
Many of these problems are described below this article in comments.
Describe the solution you'd like
I'd like to have an easy way to log request and response bodies in ASP.NET Core.
Solutions:
Request and response bodies should be strings instead of streams (don't know if this is possible)
Give a user some method to get request and response body as a string.
Additional context
Almost every app needs some way to log events happening in it. Middleware in ASP.NET Core seems the best place to include logging. Unfortunately, there is no official or approved solution on how to perform logging request and responses in ASP.NET Core.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
I am trying to build a logging mechanism in my app which logs every request and response. There are many tutorials on how to do this. I think the most popular is:
https://exceptionnotfound.net/using-middleware-to-log-requests-and-responses-in-asp-net-core/
Unfortunately, I think that logging request and response bodies is too complicated because both request body and response body are Streams instead of strings. Just look at this code in this article. To achieve just simple logging we have to write a lot of difficult code. This also causes other problems which are related to Streams, i.e. Large Object Heap.
Many of these problems are described below this article in comments.
Describe the solution you'd like
I'd like to have an easy way to log request and response bodies in ASP.NET Core.
Solutions:
Additional context
Almost every app needs some way to log events happening in it. Middleware in ASP.NET Core seems the best place to include logging. Unfortunately, there is no official or approved solution on how to perform logging request and responses in ASP.NET Core.
The text was updated successfully, but these errors were encountered: