禁用 .NET Core EF 2.0 查询日志记录 [英] Disable .NET Core EF 2.0 Query Logging

查看:35
本文介绍了禁用 .NET Core EF 2.0 查询日志记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前 .NET CORE EF 2.0 将始终记录查询信息,有没有办法禁用查询日志记录?

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

推荐答案

如果您仔细查看日志,您会看到信息"标签.您可以在 appSetings 文件中编辑日志级别.您应该考虑将它们留在生产环境以外的其他环境中,因为它们有时会很有用.

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.

至于你问的是什么,这里有一个 appSetings.json 的例子,用于记录警告和更高级别.

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"
    }
}

这篇关于禁用 .NET Core EF 2.0 查询日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆