Search code examples
serilogseqseq-logging

Howto log to 2 instances of same type of sink (Seq)?


Possible? Cannot find a "sink forwarder", where one sink can forward to several other sinks, possibly of the same type.

Serilogs documentation (https://github.com/serilog/serilog/wiki/AppSettings) clearly states that

NOTE: When using serilog: keys need to be unique.*

so adding the same Seq sink several times doesnt seem to be a good idea.

I'm looking for the same concept as in log4net, where one logger can hold several appenders.


Solution

  • Unfortunately the <appSettings> config provider for Serilog doesn't support this case; the appSettings.json one does, if you're able to use it, otherwise configuring the sinks in code WriteTo.Seq(...).WriteTo.Seq(...) is the way to go.