0
nicolaslau created
i try a normal way to enable ef core`s logging by setting in appsetting.json
"Logging": { "LogLevel": { "Microsoft.EntityFrameworkCore": "Debug" } }
but i cann`t see any sql logging in log file.
2 Answer(s)
-
0
hi nicolaslau
You can try this code.
public static readonly LoggerFactory MyLoggerFactory = new LoggerFactory(new[] { new Log4NetProvider("log4net.config") }); public static void Configure(DbContextOptionsBuilder<DbContext> dbContextOptions, string connectionString) { dbContextOptions.UseLoggerFactory(MyLoggerFactory).UseMySql(connectionString); } public static void Configure(DbContextOptionsBuilder<DbContext> builder, DbConnection connection) { builder.UseLoggerFactory(MyLoggerFactory).UseMySql(connection); }
From: https://github.com/aspnetboilerplate/aspnetboilerplate/issues/3599#issue-339294569
-
0
@maliming thanks.
I add the logger factory from abp`s ILoggerFactory by DI.