Tweak logging, ZUGFeRD Import
This commit is contained in:
parent
af00fab575
commit
463f4ce22d
@ -4,7 +4,6 @@ Imports System.Linq
|
||||
Imports DigitalData.Modules.Database
|
||||
Imports DigitalData.Modules.Interfaces
|
||||
Imports DigitalData.Modules.Logging
|
||||
Imports DigitalData.Modules.Filesystem
|
||||
Imports System.Text.RegularExpressions
|
||||
Imports DigitalData.Modules.Jobs.Exceptions
|
||||
Imports FirebirdSql.Data.FirebirdClient
|
||||
@ -111,7 +110,7 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
_firebird.ExecuteNonQuery(oSQLInsert)
|
||||
|
||||
_logger.Info("Email Queue updated for MessageId {0}.", FileGuid, oEmailTo)
|
||||
_logger.Debug("Email Queue updated for MessageId {0}.", FileGuid, oEmailTo)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
End Try
|
||||
@ -160,6 +159,7 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
_logger.Info("Starting Job {0}", Me.GetType.Name)
|
||||
|
||||
Try
|
||||
For Each oPath As String In args.WatchDirectories
|
||||
Dim oDirInfo As New DirectoryInfo(oPath)
|
||||
|
||||
@ -195,6 +195,7 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oFileGroupId As String = oFileGroup.Key
|
||||
Dim oMissingProperties As New List(Of String)
|
||||
|
||||
_logger.NewBlock($"Message Id {oFileGroupId}")
|
||||
_logger.Info("Start processing file group {0}", oFileGroupId)
|
||||
|
||||
Try
|
||||
@ -205,12 +206,12 @@ Public Class ImportZUGFeRDFiles
|
||||
oMissingProperties = New List(Of String)
|
||||
oCurrentFileCount += 1
|
||||
|
||||
_logger.Info($"({oCurrentFileCount}/{oFileCount}) Start processing file {oFile.Name}")
|
||||
_logger.Info("Start processing file {0}", oFile.Name)
|
||||
|
||||
Try
|
||||
oDocument = _zugferd.ExtractZUGFeRDFile(oFile.FullName)
|
||||
Catch ex As Exception
|
||||
_logger.Warn($"({oCurrentFileCount}/{oFileCount}) File is not a valid ZUGFeRD document! Skipping.")
|
||||
_logger.Warn("File is not a valid ZUGFeRD document! Skipping.")
|
||||
Continue For
|
||||
End Try
|
||||
|
||||
@ -284,15 +285,22 @@ Public Class ImportZUGFeRDFiles
|
||||
' Move all files of the current group
|
||||
For Each oFile In oFileGroupFiles
|
||||
_filesystem.MoveTo(oFile.FullName, oMoveDirectory)
|
||||
_logger.Info("({1}/{2}) Finished processing file {0}", oFile.Name, oCurrentFileCount, oFileCount)
|
||||
_logger.Info($"({1}/{2}) File moved to {0}", oMoveDirectory)
|
||||
_logger.Info("Finished processing file {0}", oFile.Name)
|
||||
_logger.Info("File moved to {0}", oMoveDirectory)
|
||||
Next
|
||||
|
||||
_logger.Info("Finished processing file group {0}", oFileGroupId)
|
||||
_logger.EndBlock()
|
||||
End Try
|
||||
Next
|
||||
End If
|
||||
Next
|
||||
|
||||
_logger.Info("Finishing Job {0}", Me.GetType.Name)
|
||||
Catch ex As Exception
|
||||
_logger.Error(ex)
|
||||
_logger.Info("Job Failed! See error log for details")
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ Public Class Exceptions
|
||||
Inherits ApplicationException
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New()
|
||||
MyBase.New("More than one ZUGFeRD document found")
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@ -25,7 +25,7 @@ Public Class Exceptions
|
||||
Inherits ApplicationException
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New()
|
||||
MyBase.New("No ZUGFeRD documents found")
|
||||
End Sub
|
||||
End Class
|
||||
End Class
|
||||
|
||||
@ -8,7 +8,15 @@ Public Class Logger
|
||||
''' </summary>
|
||||
''' <param name="blockId">A unique Identifier for this block, eg. DocId, FullPath, ..</param>
|
||||
Public Sub NewBlock(blockId As String)
|
||||
Dim message As String = $"=========={vbTab}{vbTab}Start of Block {blockId}{vbTab}{vbTab}=========="
|
||||
Dim message As String = $"-----> Start of Block {blockId}"
|
||||
Dim logEventInfo As New LogEventInfo(LogLevel.Info, Name, message)
|
||||
Dim WrapperType As Type = GetType(Logger)
|
||||
|
||||
Log(WrapperType, logEventInfo)
|
||||
End Sub
|
||||
|
||||
Public Sub EndBlock()
|
||||
Dim message As String = $"<----- End of Block"
|
||||
Dim logEventInfo As New LogEventInfo(LogLevel.Info, Name, message)
|
||||
Dim WrapperType As Type = GetType(Logger)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user