I want my logs to persist in different folders based on their level. And I want this configuration to be completely via config file rather than hard-coded configs as it may change in future. Doing so in NLog
configuration file is pretty easy, but I didn't find it how to do advanced log configuration in Serilog
. Any suggestion?
Currently I have this:
"Serilog": {
"Using": [ "Serilog.Sinks.Console" ],
"MinimumLevel": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
},
"WriteTo": [
{ "Name": "Console" },
{
"Name": "File",
"Args": {
"path": "logs\\AppLogs_.txt",
"rollingInterval": "Hour",
"fileSizeLimitBytes": 15000000,
"rollOnFileSizeLimit": true,
"shared": true,
"outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [{Level}]) {Message} {NewLine} {Exception}"
}
}
],
"Enrich": [ "FromLogContext", "WithMachineName", "WithThreadId" ]
}