We are using .NET Core 3.1, Microsoft.EntityFrameworkCore 3.1.9, Npgsql 4.1.9, Karambolo.Extensions.Logging.File 3.3.1 and linq2db.EntityFrameworkCore 3.7.0.
We have the following Karambolo configuration in appsettings.json
:
{
"Logging": {
"File": {
"TextBuilderType": "MyProject.Web.Logging.LogEntryTextBuilder, MyProject.Web",
"BasePath": "AppData/Logs",
"EnsureBasePath": true,
"LogLevel": {
"Default": "Information"
},
"FileEncoding": "utf-8",
"DateFormat": "yyyyMMdd",
"CounterFormat": "000",
"MaxFileSize": 10485760,
"IncludeScopes": true,
"MaxQueueSize": 100,
"Files": [{
"Path": "MyProject-<date>-<counter>.log",
"MinLevel": {
"MyProject": "Information",
"Microsoft.EntityFrameworkCore.Database.Command": "Information",
"LinqToDB.EntityFrameworkCore": "Information"
}
}]
}
}
}
We also have the following configuration for linq2db logging:
private void ConfigureLinq2DbConsoleLogging()
{
DataConnection.TurnTraceSwitchOn();
DataConnection.WriteTraceLine = (string s1, string s2, TraceLevel tl) => Debug.WriteLine($"{s1}: {s2}");
}
However, we can't see any logs related to linq2db in MyProject-20230331-000.log
file. Our goal is to log all executed SQL queries by linq2db. SQL queries executed by EF Core are logged normally (Microsoft.EntityFrameworkCore.Database.Command
namespace).