Log failover with Serilog

落花浮王杯 提交于 2021-01-28 22:53:53

问题


Is it possible, using Serilog, to log to a webservice of mine and if throws an error (no internet, for instance) to log to a RollingFile. Should only log to RollingFile if WebService fails.


回答1:


You can implement this yourself by creating a custom sink that wraps another new RollingFileSink(...) and only forwards events if the web service call fails.

To do this you'd implement ILogEventSink or, if the web service accepts batches, create a subclass of PeriodicBatchingSink.



来源:https://stackoverflow.com/questions/33533277/log-failover-with-serilog

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!