1

I used Serilog 1.x and following worked there:

In code:

Log.Logger = new LoggerConfiguration().ReadFrom.AppSettings().CreateLogger();

In app.config:

<add key="serilog:write-to:RollingFile.pathFormat" value="C:\Temp\MyService\Log-{Date}.log" />

But now with Serilog 2.1 seems that any write-to isn't working from app.config. When I put them straight to code it works but I want them to app.config. What is wrong with my code/app.config?

Lassi Autio
  • 1,147
  • 1
  • 13
  • 35

1 Answers1

1

I luckily resolved this myself. Seems that in 2.x version there need to be serilog:using for every sink in app.config. I added following to use RollingFile and Seq:

<add key="serilog:using:RollingFile" value="Serilog.Sinks.RollingFile" />
<add key="serilog:using:Seq" value="Serilog.Sinks.Seq" />

And now both rolling files and Seq works.

Lassi Autio
  • 1,147
  • 1
  • 13
  • 35