diff --git a/ATXCommon/Serializables/ServiceStatus.cs b/ATXCommon/Serializables/ServiceStatus.cs index 19da781b0d24f60a4e35ce8939dcd4332583c53f..2d3a07e19f14b59ae8f30194382e39019e0aad62 100644 --- a/ATXCommon/Serializables/ServiceStatus.cs +++ b/ATXCommon/Serializables/ServiceStatus.cs @@ -13,7 +13,6 @@ namespace ATXCommon.Serializables { [XmlIgnore] private string _storageFile; // remember where we came from [XmlIgnore] private ServiceConfig _config; - [XmlIgnore] public string ValidationWarnings; [XmlIgnore] private static readonly Logger Log = LogManager.GetCurrentClassLogger(); private DateTime _lastStatusUpdate; @@ -221,23 +220,29 @@ namespace ATXCommon.Serializables // CurrentTransferSrc if (s.CurrentTransferSrc.Length > 0 && !Directory.Exists(s.CurrentTransferSrc)) { - s.ValidationWarnings += " - found non-existing source path of an unfinished " + - "transfer: " + s.CurrentTransferSrc + "\n"; + ReportInvalidStatus("CurrentTransferSrc", s.CurrentTransferSrc, + "invalid transfer source path"); s.CurrentTransferSrc = ""; } // CurrentTargetTmp - var currentTargetTmpPath = Path.Combine(s._config.DestinationDirectory, - s._config.TmpTransferDir, - s.CurrentTargetTmp); + var currentTargetTmpPath = s.CurrentTargetTmpFull(); if (s.CurrentTargetTmp.Length > 0 && !Directory.Exists(currentTargetTmpPath)) { - s.ValidationWarnings += " - found non-existing temporary path of an " + - "unfinished transfer: " + currentTargetTmpPath + "\n"; + ReportInvalidStatus("CurrentTargetTmpPath", currentTargetTmpPath, + "invalid temporary path of an unfinished transfer"); s.CurrentTargetTmp = ""; } } + /// <summary> + /// Print a standardized msg about an invalid status attribute to the log. + /// </summary> + private static void ReportInvalidStatus(string attribute, string value, string msg) { + Log.Warn(">>> Invalid status parameter detected, resetting:\n - <{0}> [{1}] {2}.", + attribute, value, msg); + } + /// <summary> /// Generate a human-readable sumary of the current transfer. /// </summary> diff --git a/AutoTx/AutoTx.cs b/AutoTx/AutoTx.cs index 9ec03441327b348ca1631f18ef37ca6b86e0b480..1920273bb6b023bc67fe987e31a7e712626b99f2 100644 --- a/AutoTx/AutoTx.cs +++ b/AutoTx/AutoTx.cs @@ -309,10 +309,6 @@ namespace AutoTx SendAdminEmail(warn); } - if (!string.IsNullOrEmpty(_status.ValidationWarnings)) { - Log.Warn("WARNING: some status parameters were invalid and have been reset:\n{0}", - _status.ValidationWarnings); - } Log.Debug(msg); }