惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
WordPress大学
WordPress大学
人人都是产品经理
人人都是产品经理
Engineering at Meta
Engineering at Meta
小众软件
小众软件
I
InfoQ
有赞技术团队
有赞技术团队
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Martin Fowler
Martin Fowler
月光博客
月光博客
雷峰网
雷峰网
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
SegmentFault 最新的问题
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
V
Visual Studio Blog
博客园 - 叶小钗
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
GbyAI
GbyAI
P
Proofpoint News Feed
Apple Machine Learning Research
Apple Machine Learning Research

博客园 - HUGO.CM

安装OpenCode后,无法使用。解决方案 修改Abp中Auto API Controllers中 默认生成的 Put、Delete请求 vs2022 开发Python 中文报错:SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xc4 in position 0: invalid continuation byte Abp9.0.4运行DbMigrator,报错“The LINQ expression '@__organizationUnitIds_0' could not be translated. ...” 执行abp命令时,出现死循环解决方案 ABP与BootstrapBlazor 本地化相关处理 【机译】ABP Helper Methods Blazor文件上传异常:Did not receive any data in the allotted time Abp报错:AbpException: No theme registered! Use AbpThemingOptions to register themes. Abp分布式实体缓存 【译】在 ABP 框架项目中配置多个数据库上下文 ABP浏览页面报错:Could not find the bundle file '/libs/abp/core/abp.css' for the bundle 'LeptonXLite.Global' 或 'Basic.Global' 运行abp install-libs再报错npm ERR! code E404 Abp配置文件设置IdentityServer客户端 精简版Abp开发教程 - 第三章: 创建应用程序 精简版Abp开发教程 - 第二章: 创建实体与数据库 精简版Abp开发教程 - 第一章: 创建解决方案 Abp vNext 使用Mysql数据库 Abp vNext 修改默认表前缀 Abp vNext 使用sql2005、sql2008等脚本报错解决
Abp vNext 在控制台输出SQL
HUGO.CM · 2022-11-04 · via 博客园 - HUGO.CM

废话不说,直接上代码
找到EntityFrameworkCore层,在DbContext类(如BookStoreDbContext)。重写OnConfiguring方法

protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
    //日志输出SQL语句
    optionsBuilder.LogTo(Console.WriteLine, LogLevel.Information)
        .EnableSensitiveDataLogging();
    base.OnConfiguring(optionsBuilder);
}

但是发现,APB内置的表,不输出日志。想输出日志
找到Host,Program类,将main方法中的代码.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning),改成.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Information)即可。