MS ZugferdService Delete LogFiles30days
This commit is contained in:
@@ -40,6 +40,21 @@ Public Class WindowsService
|
||||
|
||||
_LogConfig = New LogConfig(LogConfig.PathType.CustomPath, IO.Path.Combine(oServicePath, "Log"))
|
||||
_Logger = _LogConfig.GetLogger()
|
||||
|
||||
Try
|
||||
Dim directory As New IO.DirectoryInfo(_LogConfig.LogDirectory)
|
||||
|
||||
For Each file As IO.FileInfo In directory.GetFiles
|
||||
If (Now - file.CreationTime).Days > 29 Then
|
||||
file.Delete()
|
||||
Else
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Catch ex As Exception
|
||||
|
||||
End Try
|
||||
|
||||
_Logger.Info("Service {0} is starting...", SERVICE_DISPLAY_NAME)
|
||||
_Logger.Info("ServiceDirectory: {0}", oServicePath)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user