ASP.NET template disables EF Core SQL logging by default · Issue #32977 · dotnet/aspnetcore (original) (raw)
Include your code
Create an ASP.NET Core app with individual user accounts so EF Core is used
dotnet new webapp -au Individual -uld -o RPauth
cd RPauth
dotnet ef database update
dotnet run
Browse to https://localhost:5001/ and create a new account. Click on the link to confirm the account. Note that no SQL is logged.
Add the following to appsettings.json:,"Microsoft.EntityFrameworkCore.Database.Command": "Information"
No need to stop/restart as appsettings.json is reloaded. Navigate to https://localhost:5001/Identity/Account/Manage can select some of the tabs on the left. SQL output is displayed.
Comment out the following and SQL output stops:
// ,"Microsoft.EntityFrameworkCore.Database.Command": "Information"
Include provider and version information
Using all defaults with .NET 5 or .NET 6
Related: dotnet/efcore#3240