c# - write-to not working from AppSettings with Serilog 2.1 -


i used serilog 1.x , 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 serilog 2.1 seems write-to isn't working app.config. when put them straight code works want them app.config. wrong code/app.config?

i luckily resolved myself. seems in 2.x version there need serilog:using every sink in app.config. added following use rollingfile , seq:

<add key="serilog:using:rollingfile" value="serilog.sinks.rollingfile" /> <add key="serilog:using:seq" value="serilog.sinks.seq" /> 

and both rolling files , seq works.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -