improve logging of missing/incorrectly configured properties
This commit is contained in:
@@ -185,6 +185,7 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
Public Sub Start(Arguments As Object) Implements IJob.Start
|
||||
Dim args As WorkerArgs = Arguments
|
||||
Dim oPropertyExtractor = New PropertyValues(_logConfig)
|
||||
|
||||
_logger.Info("Starting Job {0}", [GetType].Name)
|
||||
|
||||
@@ -308,7 +309,7 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
' get properties as a nested object, see `oPropertyList`
|
||||
For Each oProperty As KeyValuePair(Of String, XmlItemProperty) In oGroup
|
||||
Dim oPropertyValues As List(Of Object) = PropertyValues.GetPropValue(oDocument, oProperty.Key)
|
||||
Dim oPropertyValues As List(Of Object) = oPropertyExtractor.GetPropValue(oDocument, oProperty.Key)
|
||||
|
||||
oPropertyList.Add(oProperty.Value, oPropertyValues)
|
||||
|
||||
@@ -328,7 +329,8 @@ Public Class ImportZUGFeRDFiles
|
||||
Dim oColumnIsEmpty = False
|
||||
|
||||
For Each oRow In oPropertyList
|
||||
Dim oValue As List(Of Object) = oRow.Value.Item(oRowIndex)
|
||||
Dim oValue As List(Of Object) = oRow.Value
|
||||
'Dim oValue As List(Of Object) = oRow.Value.Item(oRowIndex)
|
||||
oColumnIsEmpty = oValue.Count = 0
|
||||
Next
|
||||
|
||||
@@ -416,7 +418,7 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
' Iterate through default properties
|
||||
For Each Item As KeyValuePair(Of String, XmlItemProperty) In oDefaultProperties
|
||||
Dim oPropertyValueList As List(Of Object) = PropertyValues.GetPropValue(oDocument, Item.Key)
|
||||
Dim oPropertyValueList As List(Of Object) = oPropertyExtractor.GetPropValue(oDocument, Item.Key)
|
||||
Dim oPropertyDescription As String = Item.Value.Description
|
||||
Dim oPropertyValue As Object = Nothing
|
||||
|
||||
@@ -428,6 +430,12 @@ Public Class ImportZUGFeRDFiles
|
||||
oPropertyValue = Nothing
|
||||
Case Else
|
||||
oPropertyValue = oPropertyValueList.First()
|
||||
|
||||
' This should hopefully show config errors
|
||||
If TypeOf oPropertyValue Is List(Of Object) Then
|
||||
_logger.Warn("Property with Description {0} may be configured incorrectly", oPropertyDescription)
|
||||
oPropertyValue = Nothing
|
||||
End If
|
||||
End Select
|
||||
End If
|
||||
|
||||
|
||||
Reference in New Issue
Block a user