 | FileLifecycleHooksOnFileDeleting Method |
Called immediately before a log file is deleted by the
FileTarget.
Namespace:
NLog.Targets
Assembly:
NLog (in NLog.dll) Version: 6.0.0+cfb73701cda54e2410b006f649f072e90daef707
Syntaxpublic virtual void OnFileDeleting(
string filePath
)
Public Overridable Sub OnFileDeleting (
filePath As String
)
Dim instance As FileLifecycleHooks
Dim filePath As String
instance.OnFileDeleting(filePath)
abstract OnFileDeleting :
filePath : string -> unit
override OnFileDeleting :
filePath : string -> unit Parameters
- filePath
- Type: SystemString
The full path to the file that is about to be deleted.
Remarks
This is a per-file event and can be used to perform custom actions before
NLog deletes the file as part of its file cleanup logic, for example when
MaxArchiveFiles or MaxArchiveDays
triggers archive cleanup.
It is possible to move, rename, or delete the file in this method, as
FileTarget silently ignores that the file is already gone.
See Also