MS ZugferdService Delete LogFiles30days
This commit is contained in:
parent
6fd11a09c7
commit
bf3a7a93dd
@ -40,6 +40,21 @@ Public Class WindowsService
|
|||||||
|
|
||||||
_LogConfig = New LogConfig(LogConfig.PathType.CustomPath, IO.Path.Combine(oServicePath, "Log"))
|
_LogConfig = New LogConfig(LogConfig.PathType.CustomPath, IO.Path.Combine(oServicePath, "Log"))
|
||||||
_Logger = _LogConfig.GetLogger()
|
_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("Service {0} is starting...", SERVICE_DISPLAY_NAME)
|
||||||
_Logger.Info("ServiceDirectory: {0}", oServicePath)
|
_Logger.Info("ServiceDirectory: {0}", oServicePath)
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,21 @@ Public Class ZUGFeRDService
|
|||||||
_logConfig = New LogConfig(PathType.CustomPath, Path.Combine(My.Application.Info.DirectoryPath, "Log"), Nothing, "Digital Data", "DDZUGFeRDService")
|
_logConfig = New LogConfig(PathType.CustomPath, Path.Combine(My.Application.Info.DirectoryPath, "Log"), Nothing, "Digital Data", "DDZUGFeRDService")
|
||||||
_logConfig.Debug = True
|
_logConfig.Debug = True
|
||||||
_logger = _logConfig.GetLogger()
|
_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($"{My.Settings.SERVICE_NAME} is starting.")
|
_logger.Info($"{My.Settings.SERVICE_NAME} is starting.")
|
||||||
|
|
||||||
Dim oDataSource As String = My.Settings.DB_DATASOURCE
|
Dim oDataSource As String = My.Settings.DB_DATASOURCE
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user