From 150a95643cf55a9ce66e154b1f21595dfb0e38e6 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Wed, 29 Apr 2020 15:01:41 +0200 Subject: [PATCH] ZUGFeRD: Improve logging for ZUGFeRD Service --- Modules.Interfaces/My Project/AssemblyInfo.vb | 2 +- Modules.Interfaces/ZUGFeRDInterface/PDFAttachments.vb | 2 +- Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb | 8 +++++--- Modules.Jobs/My Project/AssemblyInfo.vb | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Modules.Interfaces/My Project/AssemblyInfo.vb b/Modules.Interfaces/My Project/AssemblyInfo.vb index 213861ec..73e75b1d 100644 --- a/Modules.Interfaces/My Project/AssemblyInfo.vb +++ b/Modules.Interfaces/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - + diff --git a/Modules.Interfaces/ZUGFeRDInterface/PDFAttachments.vb b/Modules.Interfaces/ZUGFeRDInterface/PDFAttachments.vb index d2382f37..17d7c5a5 100644 --- a/Modules.Interfaces/ZUGFeRDInterface/PDFAttachments.vb +++ b/Modules.Interfaces/ZUGFeRDInterface/PDFAttachments.vb @@ -117,7 +117,7 @@ Public Class PDFAttachments Continue For End If Else - Logger.Warn("File [{0}] was skipped because its extension [{1}] is not allowed.", oFileName, oExtension) + Logger.Debug("File [{0}] was skipped because its extension [{1}] is not allowed.", oFileName, oExtension) Continue For End If Else diff --git a/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb b/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb index 2bfb4757..edbef779 100644 --- a/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb +++ b/Modules.Jobs/EDMI/ZUGFeRD/ImportZUGFeRDFiles.vb @@ -27,6 +27,7 @@ Public Class ImportZUGFeRDFiles Public HISTORY_ID As Integer ' List of allowed extensions for PDF/A Attachments + ' This list should not contain xml so the zugferd xml file will be filtered out Private ReadOnly AllowedExtensions As List(Of String) = New List(Of String) From {"docx", "doc", "pdf", "xls", "xlsx", "ppt", "pptx", "txt"} Private ReadOnly _logger As Logger @@ -185,22 +186,23 @@ Public Class ImportZUGFeRDFiles Catch ex As ZUGFeRDExecption Select Case ex.ErrorType Case ZUGFeRDInterface.ErrorType.NoZugferd - _logger.Warn("File is not a valid ZUGFeRD document! Skipping.") + _logger.Warn("File [{0}] is not a valid ZUGFeRD document! Skipping.", oFile.Name) oEmailAttachmentFiles.Add(oFile) Continue For Case ZUGFeRDInterface.ErrorType.NoValidZugferd - _logger.Warn("File is an Incorrectly formatted ZUGFeRD document!") + _logger.Warn("File [{0}] is an Incorrectly formatted ZUGFeRD document!", oFile.Name) Throw New InvalidFerdException() Case Else - _logger.Warn("Unexpected Error occurred while extracting ZUGFeRD Information from file {0}", oFile.FullName) + _logger.Warn("Unexpected Error occurred while extracting ZUGFeRD Information from file {0}", oFile.Name) Throw ex End Select End Try ' Extract all attachments with the extensions specified in `AllowedExtensions`. ' If you need to extract and use embedded xml files, you need to filter out the zugferd-invoice.xml yourself. + ' Right now the zugferd-invoice.xml is filtered out because `AllowedExtensions` does not contain `xml`. Dim oAttachments = oAttachmentExtractor.Extract(oFile.FullName, AllowedExtensions) If oAttachments Is Nothing Then _logger.Warn("Attachments for file [{0}] could not be extracted", oFile.FullName) diff --git a/Modules.Jobs/My Project/AssemblyInfo.vb b/Modules.Jobs/My Project/AssemblyInfo.vb index 0fe78cac..8e2ba0be 100644 --- a/Modules.Jobs/My Project/AssemblyInfo.vb +++ b/Modules.Jobs/My Project/AssemblyInfo.vb @@ -30,5 +30,5 @@ Imports System.Runtime.InteropServices ' Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern ' übernehmen, indem Sie "*" eingeben: - +