serilog-settings-appsettings icon indicating copy to clipboard operation
serilog-settings-appsettings copied to clipboard

Watch the config file at runtime

Open chucklu opened this issue 4 years ago • 3 comments

Try to figure out the feature about watch the App.config at runtime like log4net and NLog https://stackoverflow.com/questions/25477415/how-can-i-reconfigure-serilog-without-restarting-the-application https://stackoverflow.com/questions/50715913/serilog-equivalent-to-log4net-config-watch The above two links have no useful info about reload all settings in App.config.

Here is another link https://stackoverflow.com/questions/53449596/reload-serilog-json-configuration-on-changes-in-net-core-2-1/60474967#60474967 The current Serilog implementation (2.9.0) is such that it is unable to fully reload settings. To work around this issue without introducing additional dependencies, avoid creating static loggers and follow the example provided here: https://github.com/akovac35/Logging/blob/v1.0.4/src/com.github.akovac35.Logging.Serilog/SerilogHelper.cs

Will you consider to implement this feature?

chucklu avatar Jul 09 '20 06:07 chucklu

Related: https://github.com/nblumhardt/serilog-reload

nblumhardt avatar Jul 14 '20 09:07 nblumhardt

Oh I wasn't aware of that repo yet! I am using tagcode/serilog-settings-reloader currently (with great success). Any two cents on the difference and general state of yours, Nick?

bddckr avatar Jul 14 '20 10:07 bddckr

Hi Christopher-Marcel; the aim currently is to get as close to zero-overhead as possible once the logger is "frozen" - mapping closely to how the ASP.NET Core framework is first bootstrapped, and then given a final logger configuration that does not change. I think Serilog.Settings.Reloader is currently more general, and is undoubtedly a bit more mature :-)

nblumhardt avatar Jul 14 '20 10:07 nblumhardt