Can I log to separate files using Serilog?

后端 未结 3 873
我寻月下人不归
我寻月下人不归 2021-01-05 07:25

My ASP.NET Core 2.1 app logs to a Serilog file sink, all the \"usual stuff\" - i.e. app related stuff such as debug, monitoring, performance, etc.

However we also ne

3条回答
  •  一生所求
    2021-01-05 08:17

    Serilog.Sinks.Map does this, and includes a file logging example:

    Log.Logger = new LoggerConfiguration()
        .WriteTo.Map("EventId", "Other", (name, wt) => wt.File($"./logs/log-{name}.txt"))
        .CreateLogger();
    

提交回复
热议问题