question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Serilog only logging to File with version 3 of Serilog

See original GitHub issue

I couldn’t get Serilog to log to a file with the API template 2.2.0. I upgraded Serilog.AspNetCore from 2.1.1 to 3.0.0 and this fixed the error. Not sure if there was another way to get it to work, but the upgrade worked.

appsettings

"WriteTo": [
      {
        "Name": "Console",
        "Theme": "Code"
      },
      { "Name": "Debug" },
      {
        "Name": "File",
        "Args": { "path": "%TEMP%\\Logs\\example.txt" }
      }
    ]

image

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
VictorioBerracommented, Sep 23, 2019

Yeah I think that’s an issue with our template. Will probably be resolved when we push it to Core 3.

0reactions
bajmmingcommented, Sep 23, 2019

Oh ok that makes sense. I’m only using the appsettings that come with the Api template, and then I’ve just added File as an extra sink without the necessary config. I’ll have a look at that sample config link you sent as there might be some settings I want to bring into my project. Thanks for the quick responses and I’ll close this issue 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Serilog - multiple log files
I use the following configuration and it works for me: Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() .WriteTo.
Read more >
Write Serilog events to files in text and JSON formats ...
Write Serilog events to files in text and JSON formats, optionally rolling on time or size - GitHub - serilog/serilog-sinks-file: Write Serilog events...
Read more >
Serilog in ASP.NET Core 3.1 - Structured Logging Made ...
Serilog supports structured logging, which allows more details and information ... For now, we have written the settings for File and Console Sinks...
Read more >
Setting up Serilog in ASP.NET Core - Detailed Beginner ...
This article covers the implementation of Serilog in ASP.NET Core which provides structured logging that is easier to be read by programs.
Read more >
Logging to files with Serilog in Asp.Net Core - YouTube
Understanding and installing needed NuGet packages: 01:33 3. Configuring the Program.cs class: 06:02 4. Configuring Serilog in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found