Disable .NET Core EF 2.0 Query Logging

2019-08-27 12:00发布

问题:

Current the .NET CORE EF 2.0 will always logging the Query info, is there a way to disable to query logging?

回答1:

If you look closely at the logs, you'll see the 'info' tag. You can edit the loglevel in your appSetings file. You should consider leaving them in others environment than production since they can be useful some times.

As for what you asked, here's an example of an appSetings.json used to log warnings and higher.

{
"Logging": {
    "IncludeScopes": false,
    "LogLevel": {
        "Default": "Warning"
    }
}