dfacto-lab / serilog-sinks-file

Serilog file sinks duplicated for file rolling
Apache License 2.0
14 stars 9 forks source link

Persistent name not working well from appsettings.json #26

Open jrouzies-fr opened 1 month ago

jrouzies-fr commented 1 month ago

Hello,

I am trying to implement your version, and have the configuration in the appsettings.json:

"Name": "File",
"Args": {
  "path": "L:\\Logs\\ProvisioningApi\\ProvisioningApi.log",
  "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff} [{Level}] {Message}{NewLine}{Exception}",
  "restrictedToMinimumLevel": "Information",
  "persistentFileRollingInterval": "Day",
  "preserveLogFilename": "true"
}

It does create properly the not-rolling file, but nothing gets written into it. If I add back the native "rollingInterval": "Day",, the classic Serilog behavior is back and write properly (but name is rolling).

Any idea?

Thanks

numito commented 1 month ago

Your configuration seems ok, could you try to directly call it from code: .WriteTo.Async( a => a.PersistentFile( .... ) )

It seems you have 2 libraries in your path, make sure it works from code and then add it to the config file.

jrouzies-fr commented 2 weeks ago

Actually I found I was writing to File, not PersistentFile

Seems to work great now, thank you