jj: better logging for folderwatch

This commit is contained in:
Jonathan Jenne 2018-06-27 15:04:57 +02:00
parent 83c3f9d7c2
commit bf43248270
2 changed files with 74 additions and 59 deletions

View File

@ -75,6 +75,8 @@ Public Class ClassInit
End If
End If
Else
ClassLogger.Add("Init_Folderwatch: folderwatch path is nothing!", True)
End If
If Not folderwatch_SCAN Is Nothing Then
CURRENT_SCAN_FOLDERWATCH = folderwatch_SCAN
@ -82,6 +84,8 @@ Public Class ClassInit
FW_ISSTARTED = True
ClassFolderWatcher.StartStop_FolderWatchSCAN()
End If
Else
ClassLogger.Add("Init_Folderwatch: folderwatch_SCAN path is nothing!", True)
End If
Catch ex As Exception
ClassLogger.Add("Unexpected Error in Init_Folderwatch: " & ex.Message, True)

View File

@ -486,68 +486,79 @@ Public Class frmStart
Else
tslblFW.Visible = False
End If
If FWSCAN_started = True Then
If LogErrorsOnly = False Then ClassLogger.Add(">> FWSCAN started - Checking file:" & CURRENT_SCAN_FOLDERWATCH, False)
Dim fileEntries As String() = Directory.GetFiles(CURRENT_SCAN_FOLDERWATCH)
' Process the list of files found in the directory.
Dim fileName As String
For Each fileName In fileEntries
If LogErrorsOnly = False Then ClassLogger.Add(">> Scanfolder after startup: Checking file:" & fileName, False)
For Each row As DataRow In DTEXCLUDE_FILES.Rows
Dim content As String = row.Item(0).ToString.ToLower
If fileName.ToLower.Contains(content) Then
Exit Sub
End If
Next
Dim handleType As String
If fileName.ToLower.EndsWith(".msg") Then
handleType = "|FW_OUTLOOK_MESSAGE|"
Else
handleType = "|FW_SIMPLEINDEXER|"
End If
'Die Datei übergeben
If LogErrorsOnly = False Then ClassLogger.Add(">> Adding file from Scanfolder after startup:" & fileName, False)
If ClassIndexFunctions.FileExistsinDropTable(fileName) = False Then
ClassFilehandle.Decide_FileHandle(fileName, handleType)
Else
ClassLogger.Add(">> Scanfolder Startup: File already exists:" & fileName, False)
End If
Next fileName
Else
If LogErrorsOnly = False Then ClassLogger.Add(">> FWSCAN not started", False)
End If
If FW_started = True Then
If LogErrorsOnly = False Then ClassLogger.Add(">> FW_started started - Checking file:" & CURRENT_FOLDERWATCH, False)
Dim fileEntries As String() = Directory.GetFiles(CURRENT_FOLDERWATCH)
' Process the list of files found in the directory.
Dim fileName As String
For Each fileName In fileEntries
If LogErrorsOnly = False Then ClassLogger.Add(">> Folderwach after startup: Checking file:" & fileName, False)
For Each row As DataRow In DTEXCLUDE_FILES.Rows
Dim content As String = row.Item(0).ToString.ToLower
If fileName.ToLower.Contains(content) Then
Exit Sub
Try
If FWSCAN_started = True Then
If LogErrorsOnly = False Then ClassLogger.Add(">> FWSCAN started - Checking file:" & CURRENT_SCAN_FOLDERWATCH, False)
Dim fileEntries As String() = Directory.GetFiles(CURRENT_SCAN_FOLDERWATCH)
' Process the list of files found in the directory.
Dim fileName As String
For Each fileName In fileEntries
If LogErrorsOnly = False Then ClassLogger.Add(">> Scanfolder after startup: Checking file:" & fileName, False)
For Each row As DataRow In DTEXCLUDE_FILES.Rows
Dim content As String = row.Item(0).ToString.ToLower
If fileName.ToLower.Contains(content) Then
Exit Sub
End If
Next
Dim handleType As String
If fileName.ToLower.EndsWith(".msg") Then
handleType = "|FW_OUTLOOK_MESSAGE|"
Else
handleType = "|FW_SIMPLEINDEXER|"
End If
Next
Dim handleType As String
If fileName.ToLower.EndsWith(".msg") Then
handleType = "|FW_OUTLOOK_MESSAGE|"
Else
handleType = "|FW_SIMPLEINDEXER|"
End If
'Die Datei übergeben
If LogErrorsOnly = False Then ClassLogger.Add(">> Adding file from Folderwatch after startup:" & fileName, False)
If ClassIndexFunctions.FileExistsinDropTable(fileName) = False Then
ClassFilehandle.Decide_FileHandle(fileName, handleType)
Else
ClassLogger.Add(">> Folderwatch Startup: File already exists:" & fileName, False)
End If
Next fileName
'Die Datei übergeben
If LogErrorsOnly = False Then ClassLogger.Add(">> Adding file from Scanfolder after startup:" & fileName, False)
If ClassIndexFunctions.FileExistsinDropTable(fileName) = False Then
ClassFilehandle.Decide_FileHandle(fileName, handleType)
Else
ClassLogger.Add(">> Scanfolder Startup: File already exists:" & fileName, False)
End If
Next fileName
Else
If LogErrorsOnly = False Then ClassLogger.Add(">> FWSCAN not started", False)
End If
Catch ex As Exception
ClassLogger.Add(">> Error while starting folderwatch scan: " & ex.Message, False)
End Try
Try
If FW_started = True Then
If LogErrorsOnly = False Then ClassLogger.Add(">> FW_started started - Checking file:" & CURRENT_FOLDERWATCH, False)
Dim fileEntries As String() = Directory.GetFiles(CURRENT_FOLDERWATCH)
' Process the list of files found in the directory.
Dim fileName As String
For Each fileName In fileEntries
If LogErrorsOnly = False Then ClassLogger.Add(">> Folderwach after startup: Checking file:" & fileName, False)
For Each row As DataRow In DTEXCLUDE_FILES.Rows
Dim content As String = row.Item(0).ToString.ToLower
If fileName.ToLower.Contains(content) Then
Exit Sub
End If
Next
Dim handleType As String
If fileName.ToLower.EndsWith(".msg") Then
handleType = "|FW_OUTLOOK_MESSAGE|"
Else
handleType = "|FW_SIMPLEINDEXER|"
End If
'Die Datei übergeben
If LogErrorsOnly = False Then ClassLogger.Add(">> Adding file from Folderwatch after startup:" & fileName, False)
If ClassIndexFunctions.FileExistsinDropTable(fileName) = False Then
ClassFilehandle.Decide_FileHandle(fileName, handleType)
Else
ClassLogger.Add(">> Folderwatch Startup: File already exists:" & fileName, False)
End If
Next fileName
Else
If LogErrorsOnly = False Then ClassLogger.Add(">> FW_started not started", False)
End If
Catch ex As Exception
ClassLogger.Add(">> Error while starting folderwatch: " & ex.Message, False)
End Try
Else
If LogErrorsOnly = False Then ClassLogger.Add(">> FW_started not started", False)
End If
If TimerFolderWatch.Enabled = False Then
TimerFolderWatch.Start()
End If