In Entity Framework Core we can log slow running queries using the interceptor system. This is easy and involves two main steps…
Create an interceptor class which inherits from DbCommandInterceptor and implement the ReaderExecuted method.
and
Register the interceptor class from the ConfigureServices method in Startup.cs