diff --git a/GUIs.ClipboardWatcher/ProfileFilter.vb b/GUIs.ClipboardWatcher/ProfileFilter.vb index 54c266b2..9ca56aff 100644 --- a/GUIs.ClipboardWatcher/ProfileFilter.vb +++ b/GUIs.ClipboardWatcher/ProfileFilter.vb @@ -362,48 +362,58 @@ Public Class ProfileFilter For Each oRow As DataRow In oDTDataSearches.Rows Dim oCountCommand = String.Empty Dim oCountConnectionId = String.Empty + Try oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty) oCountConnectionId = NotNull(oRow.Item("CONN_ID"), 0) If oCountCommand = String.Empty Then - _Logger.Debug("oCountCommand = String.Empty ==> Continue for") + _Logger.Debug("Data SQL Query is empty. Skipping.") Continue For End If + _Logger.Debug("Count-Command DATA BEFORE Replace: [{0}]", oCountCommand) oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand) oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User) oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents) - _Logger.Debug($"Count-Command DATA before execute: [{oCountCommand}]") - + _Logger.Debug("Count-Command DATA before execute: [{0}]", oCountCommand) Dim oConnectionString = ProfileUtils.GetConnectionString(Database, oCountConnectionId) - oResultData += NotNull(Of Integer)(Database.GetScalarValueWithConnection(oCountCommand, oConnectionString), 0) + + _Logger.Debug("Datarows returned from search: [{0}]", oResultData) Catch ex As Exception - _Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand) + _Logger.Error(ex) + _Logger.Warn("Invalid SQL Query for Counting Data in Profile [{0}]: [{1}]", oProfile.Guid, oCountCommand) End Try Next For Each oRow As DataRow In oDTDocSearches.Rows Dim oCountCommand = String.Empty + Dim oCountConnectionId = String.Empty + Try oCountCommand = NotNull(oRow.Item("COUNT_COMMAND"), String.Empty) + oCountConnectionId = NotNull(oRow.Item("CONN_ID"), 0) If oCountCommand = String.Empty Then + _Logger.Debug("Document SQL Query is empty. Skipping.") Continue For End If - _Logger.Debug($"Count-Command DOCS BEFORE Replace: {oCountCommand}") + + _Logger.Debug("Count-Command for Documents BEFORE Replace: [{0}]", oCountCommand) oCountCommand = oPatterns.ReplaceInternalValues(oCountCommand) - ' _Logger.Debug($"Count-Command DOCS AFTER ReplaceInternalValues: {oCountCommand}") oCountCommand = oPatterns.ReplaceUserValues(oCountCommand, User) - ' _Logger.Debug($"Count-Command DOCS AFTER ReplaceUserValues: {oCountCommand}") oCountCommand = oPatterns.ReplaceClipboardContents(oCountCommand, ClipboardContents) - _Logger.Debug($"Count-Command DOCS BEFORE execute: {oCountCommand}") - oResultDocs += NotNull(Of Integer)(Database.GetScalarValue(oCountCommand), 0) - _Logger.Debug($"oResultDocs: {oResultDocs}") + + _Logger.Debug("Count-Command for Documents BEFORE execute: [{0}]", oCountCommand) + Dim oConnectionString = ProfileUtils.GetConnectionString(Database, oCountConnectionId) + oResultDocs += NotNull(Of Integer)(Database.GetScalarValueWithConnection(oCountCommand, oConnectionString), 0) + + _Logger.Debug("Documents returned from search: [{0}]", oResultDocs) Catch ex As Exception - _Logger.Warn("Invalid SQL Query for Counting Data in Profile {0}: {1}", oProfile.Guid, oCountCommand) + _Logger.Error(ex) + _Logger.Warn("Invalid SQL Query for Counting Data in Profile [{0}]: [{1}]", oProfile.Guid, oCountCommand) End Try Next @@ -414,7 +424,7 @@ Public Class ProfileFilter For Each oProfile In Profiles If oProfile.CountData > 0 Or oProfile.CountDocs > 0 Then oProfiles.Add(oProfile) - _Logger.Info("Profile {0} matched in FilterProfilesBySearchResults!", oProfile.Name) + _Logger.Info("Profile [{0}] matched in FilterProfilesBySearchResults!", oProfile.Name) End If Next