1.在WMSBase.EntityFrameworkCore 安装
Microsoft.Extensions.Logging.Debug
2. 在WMSBaseDbContext类中添加
public static readonly LoggerFactory MyLoggerFactory = new LoggerFactory(new[] { new DebugLoggerProvider() }); protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { base.OnConfiguring(optionsBuilder); optionsBuilder.UseLoggerFactory(MyLoggerFactory); }