From 0ee95e5299c7762825b59db60465f0092e6088a2 Mon Sep 17 00:00:00 2001 From: Niko Ehrenfeuchter <nikolaus.ehrenfeuchter@unibas.ch> Date: Fri, 16 Feb 2018 11:20:52 +0100 Subject: [PATCH] Log message changes only. Refers to #18 --- ATxCommon/Serializables/ServiceConfig.cs | 10 ++++++---- ATxService/AutoTx.cs | 8 +++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ATxCommon/Serializables/ServiceConfig.cs b/ATxCommon/Serializables/ServiceConfig.cs index 74284c8..967b3b4 100644 --- a/ATxCommon/Serializables/ServiceConfig.cs +++ b/ATxCommon/Serializables/ServiceConfig.cs @@ -252,6 +252,7 @@ namespace ATxCommon.Serializables /// <param name="path">The path to the configuration files.</param> /// <returns>A ServiceConfig object with validated settings.</returns> public static ServiceConfig Deserialize(string path) { + Log.Trace("ServiceConfig.Deserialize({0})", path); ServiceConfig config; var commonFile = Path.Combine(path, "config.common.xml"); @@ -261,25 +262,25 @@ namespace ATxCommon.Serializables // behaviour of the .NET XmlSerializer on duplicates: only the first occurrence is // used, all other ones are silentley being discarded - this way we simply append the // contents of the common config file to the host-specific and deserialize then: + Log.Debug("Loading host specific configuration XML file: [{0}]", specificFile); var combined = XElement.Load(specificFile); - Log.Debug("Loaded host specific configuration XML file: [{0}]", specificFile); // the common configuration file is optional, so check if it exists at all: if (File.Exists(commonFile)) { + Log.Debug("Loading common configuration XML file: [{0}]", commonFile); var common = XElement.Load(commonFile); - Log.Debug("Loaded common configuration XML file: [{0}]", commonFile); combined.Add(common.Nodes()); Log.Trace("Combined XML structure:\n\n{0}\n\n", combined); } using (var reader = XmlReader.Create(new StringReader(combined.ToString()))) { - Log.Debug("Trying to parse combined XML."); + Log.Debug("Trying to parse combined XML..."); var serializer = new XmlSerializer(typeof(ServiceConfig)); config = (ServiceConfig) serializer.Deserialize(reader); } ValidateConfiguration(config); - Log.Debug("Successfully parsed and validated configuration XML."); + Log.Debug("Successfully parsed a valid configuration from [{0}].", path); return config; } @@ -287,6 +288,7 @@ namespace ATxCommon.Serializables /// Validate the configuration, throwing exceptions on invalid parameters. /// </summary> private static void ValidateConfiguration(ServiceConfig c) { + Log.Debug("Validating configuration..."); var errmsg = ""; string CheckEmpty(string value, string name) { diff --git a/ATxService/AutoTx.cs b/ATxService/AutoTx.cs index 6787945..85a00c1 100644 --- a/ATxService/AutoTx.cs +++ b/ATxService/AutoTx.cs @@ -207,17 +207,15 @@ namespace ATxService "configuration.xml"); try { _config = ServiceConfig.Deserialize(confPath); - Log.Debug("Loaded config from [{0}]", confPath); } catch (ConfigurationErrorsException ex) { - Log.Error("ERROR validating configuration file [{0}]: {1}", - confPath, ex.Message); + Log.Error("Validating configuration failed: {0}", ex.Message); throw new Exception("Error validating configuration."); } catch (Exception ex) { - Log.Error("loading configuration XML failed: {0}", ex.Message); + Log.Error("Loading configuration failed: {0}", ex.Message); // this should terminate the service process: - throw new Exception("Error loading config."); + throw new Exception("Error loading configuration."); } } -- GitLab