Reputation: 30208
Looking at this similar question I need to do the same thing, that is I want the SQL to be copied to my Output, but I need it done for EF Core / 7
I tried adding the LogFactory
as is shown in this example
But that did not produce the SQL output either... what am I missing?
Upvotes: 0
Views: 2787
Reputation: 105
You can also install dotnet tools. The repository contains command-line tools for the .NET Core CLI.
Running dotnet watch run, debugs the application as well as showing you any sql queries that are executed.
I am coding with VS code and not 100% sure if it will work in Visual Studio.
Upvotes: 0
Reputation: 3677
The EF Core 1.1 example you linked to should work, assuming you have the following in your Configure
method in your Startup.cs
:
public void Configure(
IApplicationBuilder application,
IHostingEnvironment environment,
ILoggerFactory loggerFactory) {
loggerFactory
.AddConsole(LogLevel.Debug) // This will output to the console/terminal
.AddDebug(LogLevel.Debug); // This will output to Visual Studio Output window
// Your additional configuration here...
}
Upvotes: 1