Serilog only logging to File with version 3 of Serilog
See original GitHub issueI 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" }
}
]
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah I think that’s an issue with our template. Will probably be resolved when we push it to Core 3.
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 😃