I saw the following appsettings.json variant in the Adam Freeman's book:
{
"ConnectionStrings": {
"MyAppDb": "connection string"
},
"Logging": {
"LogLevel": {
"Default": "None",
"Microsoft.EntityFrameworkCore": "Information"
}
}
}
Then author tells:
This logging configuration will let you see the messages produced by Entity Framework Core that reveal the SQL commands that are sent to the database and prevent them from being lost in a stream of other messages.
I would like to see which SQL EF makes for my database. Unfortunately, the above approach does not work. Maybe it's happening because I'm using postgres and Npgsql and I have to put another setting in the appsettings.file? I have tried this:
{
"ConnectionStrings": {
"MyAppDb": "connection string"
},
"Logging": {
"LogLevel": {
"Default": "None",
"Npgsql.EntityFrameworkCore.PostgreSQL": "Information"
}
}
}
But without success( Just silence in the console. Pleas, help. Thank you.
log_statement = allon the pg server side. See doc