Skip to content

Commit af8ff9b

Browse files
Adds debug logging to config manager
Adds debug logging to the service config manager to assist with troubleshooting configuration loading issues. This change adds logging for scenarios where the config file is empty, not found, or fails to load.
1 parent 592e7ae commit af8ff9b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/Certify.Shared/Utils/ServiceConfigManager.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,19 @@ public static ServiceConfig GetAppServiceConfig()
3434
{
3535
serviceConfig = JsonConvert.DeserializeObject<ServiceConfig>(config);
3636
}
37+
else
38+
{
39+
System.Diagnostics.Debug.WriteLine($"ServiceConfigManager: Empty service config found at {serviceConfigFile}");
40+
}
3741

3842
serviceConfig.ConfigStatus = ConfigStatus.NotModified;
3943
}
4044
else
4145
{
4246
serviceConfig.ConfigStatus = ConfigStatus.New;
47+
48+
System.Diagnostics.Debug.WriteLine($"ServiceConfigManager: No service config found at {serviceConfigFile}");
49+
4350
}
4451
}
4552
catch (Exception exp)
@@ -49,11 +56,16 @@ public static ServiceConfig GetAppServiceConfig()
4956
serviceConfig.ConfigStatus = ConfigStatus.DefaultFailed;
5057
serviceConfig.ServiceFaultMsg = $"There was a problem loading the service configuration from {serviceConfigFile} {exp.Message}";
5158
}
59+
else
60+
{
61+
System.Diagnostics.Debug.WriteLine($"ServiceConfigManager: Fault loading service config found at {exp}");
62+
}
5263
}
5364

5465
// if something went wrong, default to standard config
5566
if (serviceConfig == null)
5667
{
68+
System.Diagnostics.Debug.WriteLine($"ServiceConfigManager: Falling back to default service config.");
5769
serviceConfig = new ServiceConfig()
5870
{
5971
ConfigStatus = ConfigStatus.DefaultFailed

0 commit comments

Comments
 (0)