In Entity Framework Core writing the executed queries to the console is easy. Just create a ILoggerFactory and then configure EF Core to use it in the OnConfiguring method.
The code below is valid as of Entity Framework Core 3.1.3.
Remember if your using a database first approach your OnConfiguring customisations will be erased when you re-scaffold your DB so put your customisations in a subclass of the EF generated context.
*** Note ***
In EF Core 5 you’ll be able exclude OnConfiguring when scaffolding.