How to disable log for the Context

.net-core entity-framework-core

Question

I upgraded to .net core 2.2 and EF 2.2 as well. Now when i fetch a table from DbSet, for each row i have in my table there a log line and it's taking forever. How to disable this since i didnt have this logs in .net core 2.0 ?

ex : for the log line i have this for each row :

[15:58:02 DBG] Context 'BookContext' started tracking 'Book' entity.
 Consider using 'DbContextOptionsBuilder.EnableSensitiveDataLogging' to see key values.

And since my table has 23000 records, i have 23000 log line as well !

My serilog log config looks like this :

"Serilog": {
        "MinimumLevel": {
            "Default": "Debug",
            "Override": {
                "Microsoft": "Debug"
            }
        },
1
1
4/16/2019 8:15:42 PM

Popular Answer

you can make like this

"Serilog": {
    "MinimumLevel": {
        "Default": "Debug",
        "Override": {
        "Microsoft.EntityFrameworkCore.Database.Command": "Error",
        "Microsoft": "Debug",
        }
    },
0
4/16/2019 8:18:37 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow