berhir / AspNetCore.SpaYarp

An alternative approach to the new ASP.NET Core SPA templates in .NET 6. It uses YARP as proxy to forward requests to the SPA dev server.
MIT License
99 stars 12 forks source link

Adjust log level #26

Closed lindsve closed 1 year ago

lindsve commented 1 year ago

The current logs from the proxy seem to spam the log stream. Are there any way to filter so f.ex only warnings from the proxy is logged?

I'm currently using Serilog and this is a sample from the console log:

[14:24:50 INF] Received HTTP/1.1 response 200.
[14:24:50 INF] SPA client is ready.
[14:24:50 INF] Proxying to http://localhost:6363/node_modules/.vite/deps/chunk-N7AMQ326.js?v=4cd2ae21 HTTP/2 RequestVersionOrLower no-streaming
[14:24:50 INF] SPA client is ready.
[14:24:50 INF] SPA client is ready.
[14:24:50 INF] Proxying to http://localhost:6363/node_modules/.vite/deps/@azure_msal-common_dist_error_AuthError.js?v=4cd2ae21 HTTP/2 RequestVersionOrLower no-streaming
[14:24:50 INF] SPA client is ready.
[14:24:50 INF] Proxying to http://localhost:6363/node_modules/.vite/deps/@equinor_eds-core-react.js?v=4cd2ae21 HTTP/2 RequestVersionOrLower no-streaming
[14:24:50 INF] Received HTTP/1.1 response 200.
[14:24:50 INF] SPA client is ready.

This makes it impossible to look for the log messages from our own application...

I tried to override the Serilog configuration with "AspNetCore.SpaYarp": "Warning", but that didn't seem to work.

lindsve commented 1 year ago

Nvm, figured it out.

The following overrides seem to work:

"Yarp.ReverseProxy": "Warning",
"AspNetCore.SpaYarp.SpaProxyMiddleware": "Warning"