Why doesn't Serilog logs querys with joins?

48 Views Asked by At

So I have the following in appsettings.json

  "Serilog": {
    "Using": [],
    "MinimumLevel": {
      "Default": "Information",
      "Override": {
        "Microsoft": "Error",
        "System": "Error",
        "Microsoft.EntityFrameworkCore.Database.Command": "Information"
      }
    }

That enabled logging of the queries being executed. However, only simple queries were logged.

Simple as in something like the below:

2023-05-05 14:42:25.915 +08:00 [INF] Executed DbCommand (1ms) [Parameters=[@biID='?'], CommandType='"Text"', CommandTimeout='30']
SELECT b."bi", b."biname", b."biID", b."value", b."UpdateLocalTimestamp"
FROM "bu" AS b
WHERE b."bi" = @biID
LIMIT 

But large queries with joins weren't logged to file.

Although it's logged to console when I used DBContextOptionsBuilder.LogTo(m => Console.WriteLine(m));

Something like:

info: 5/5/2023 14:42:11.208 RelationalEventId.CommandExecuted[20101] (Microsoft.EntityFrameworkCore.Database.Command) 
      Executed DbCommand (9ms) [Parameters=[@bi='', @__roleNames_1='System.String[]' (DbType = Object)], CommandType='Text', CommandTimeout='30']
      SELECT p."Name"
      FROM "p" AS p
      INNER JOIN "rp" AS p0 ON p."Id" = p0."pid"
      INNER JOIN "ros" AS p1 ON p0."rid" = p1."Id"
      WHERE ((p0."bi" = @bi) AND (p1."bi" = @bi)) AND ....

Not sure what I might be missing?

0

There are 0 best solutions below