Mojtabarezaei4 / Queueomatic

A queue system that can be used for educational purposes or for any other situations where prioritization of individuals is necessary.
https://queueomatic.azurewebsites.net/
MIT License
7 stars 2 forks source link

Filter the logs #171

Closed Mojtabarezaei4 closed 7 months ago

Mojtabarezaei4 commented 7 months ago

Filtering the loggers to log only warnings and errors. In both the server and client side.

FabianAronsson commented 7 months ago

How should this be acomplished?

Mojtabarezaei4 commented 7 months ago

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.

FabianAronsson commented 7 months ago

I see, so this is related only to EF Core?

Perhaps some there should be some global error logger that picks up errors?

Mojtabarezaei4 commented 7 months ago

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.

FabianAronsson commented 7 months ago

That sounds good as we do not really need to know when a database operation was performed.

Only errors and warnings are of interest.