In Entity Framework Core (2.2+) if you’re capturing queries in logs consider using the TagWith feature to output an arbitrary comment along with your queries. This can be helpful for identifying where in the code a particular query is executed from or to otherwise provide some context which will be helpful when scrolling through the logs.
Usage is simple, for example, the following query…
will produce the following SQL…