serilog-sinks-file
serilog-sinks-file copied to clipboard
Consider enabling `FileLifecycleHooks` for shared log files
Currently, we throw if hooks
are specified and shared
is true
.
This is mostly because it's tricky to use stream wrapping (one of the main use cases) with the atomic-append-based shared file sink, but also because it's unclear how many hooks could be implemented correctly in the synchronization-free world of the atomic-append sink.
When both hooks
and shared
are set, we could fall back to using the (portable) OS-mutex-based shared file sink. This would be simpler to integrate the hooks into, and we could call the hooks under the mutex to improve chances of writing correct implementations.
Hi @nblumhardt is this something can can be supported? currently I need to know the name of the log file inside my ILogEventSink implementation so I use hook the get the file name on OnFileOpened method but also need shared file to be able to copy the file to other location periodically.
currently I'm getting 'File lifecycle hooks are not currently supported for shared log files. Parameter name: hooks' exception