EDMIService: Rework NewFile and SetAttributeValue

This commit is contained in:
Jonathan Jenne
2021-11-29 11:07:46 +01:00
parent 2bd54ccad0
commit 23aad7e9c0
28 changed files with 847 additions and 203 deletions

View File

@@ -38,23 +38,9 @@ Public Class WindowsService
Try
Dim oServicePath As String = AppDomain.CurrentDomain.BaseDirectory
_LogConfig = New LogConfig(LogConfig.PathType.CustomPath, IO.Path.Combine(oServicePath, "Log"), Nothing, Nothing, Nothing, 3)
_LogConfig = New LogConfig(LogConfig.PathType.CustomPath, IO.Path.Combine(oServicePath, "Log"), FileKeepRangeInDays:=3)
_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
_Logger.Error(ex)
End Try
_Logger.Info("Service {0} is starting...", SERVICE_DISPLAY_NAME)
_Logger.Info("ServiceDirectory: {0}", oServicePath)
@@ -132,28 +118,6 @@ Public Class WindowsService
End Try
End Sub
Private Sub UpdateTraceLogging()
Try
' Changing Tracelevels programmatically,
' See: https://wcfpro.wordpress.com/2010/11/21/how-to-add-wcf-traces-programmatically/
_Logger.Debug("UpdateTraceLogging running..")
_Logger.Debug("SourceLevels is off by default")
Dim oTraceLevel = SourceLevels.Off
_Logger.Debug("Debug is currently set to {0}", _ConfigManager.Config.Debug)
If _ConfigManager.Config.Debug Then
oTraceLevel = SourceLevels.Warning
End If
_Logger.Debug("Setting TraceLevel to {0}", oTraceLevel)
WcfTracesController.Instance.LevelController(oTraceLevel)
Catch ex As Exception
_Logger.Warn("TraceLogging could not be updated!")
_Logger.Error(ex)
End Try
End Sub
Private Function StartFirebird() As Firebird
_Logger.Debug("Connecting to Firebird")