Skip to content

ASP.NET template disables EF Core SQL logging by default #32977

Closed
@Rick-Anderson

Description

@Rick-Anderson

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

Metadata

Metadata

Assignees

Labels

area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesfeature-templates

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions