Closed Mojtabarezaei4 closed 7 months ago
How should this be acomplished?
The most simple way is by adding a logging filter
builder.Logging.AddFilter("Microsoft.EntityFrameworkCore.Database.Command", LogLevel.Warning);
, but I don't think it's the best practice.
I see, so this is related only to EF Core?
Perhaps some there should be some global error logger that picks up errors?
I found another way by adding the LogLevel in appsettings.json. https://learn.microsoft.com/en-us/ef/core/logging-events-diagnostics/simple-logging
At the moment I see the most interaction with the database is when we retrieving or sending data to the database. We can just filter this option by adding "Microsoft.EntityFrameworkCore.Database": "Warning"
as a property to the LogLevel.
That sounds good as we do not really need to know when a database operation was performed.
Only errors and warnings are of interest.
Filtering the loggers to log only warnings and errors. In both the server and client side.