Search code examples
asp.net-coreserilog

Why can't I see my Console logs from Serilog?


I am new to Serilog and I was able to log to a file, but I can't seem to see my logs in console.

In my console this is what I see:

https://gyazo.com/7bf1dbf4eef0ed334576a170f6f73f0f

Here is my settings for Serilog

{
  "Serilog": {
    "Using": [
      "Serilog.Sinks.Console"
    ],
    "WriteTo": [
      {
        "Name": "Async",
        "Args": {
          "configure": [
            {
              "Name": "File",
              "Args": {
                "path": "log-.txt",
                "rollingInterval": "Day",
                "outputTemplate": "{Timestamp:o} [{Level:u3}] ({Application}/{MachineName}/{ThreadId}) {Message}{NewLine}{Exception}"
              }
            },
            {
              "Name": "Console"
            }
          ]
        }
      }
    ]
  }
}


Solution

  • The documentation of the Serilog.Console sink (screenshot below) has all the settings you need to configure.

    It also looks like you are confusing Console output with Debug output. If you want to write to the Debug output, then you need to use Serilog's Debug Sink instead.


    Serilog Settings