Skip to content

Commit 1a56612

Browse files
authored
fix: Include config file path in the "Agent is disabled " message on all platforms. (#1727)
1 parent 1aa5680 commit 1a56612

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/Agent/NewRelic/Agent/Core/Config/ConfigurationLoader.cs

+8
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,14 @@ public static ValueWithProvenance<string> GetConfigSetting(string key)
111111
value = new ValueWithProvenance<string>(ConfigurationManager.AppSettings[key],
112112
"ConfigurationManager app setting");
113113
}
114+
#else
115+
if (value?.Value == null)
116+
{
117+
var configMgrStatic = new ConfigurationManagerStatic();
118+
var configValue = configMgrStatic.GetAppSetting(key);
119+
if (configValue != null)
120+
value = new ValueWithProvenance<string>(configValue, configMgrStatic.AppSettingsFilePath);
121+
}
114122
#endif
115123
return value;
116124
}

src/Agent/NewRelic/Agent/Core/NewRelic.Agent.Core/AgentManager.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private AgentManager()
152152
private void AssertAgentEnabled(configuration config)
153153
{
154154
if (!Configuration.AgentEnabled)
155-
throw new Exception(string.Format("The New Relic agent is disabled. Update {0} to re-enable it.", config.AgentEnabledAt));
155+
throw new Exception(string.Format("The New Relic agent is disabled. Update {0} to re-enable it.", config.AgentEnabledAt ?? config.ConfigurationFileName));
156156

157157
if ("REPLACE_WITH_LICENSE_KEY".Equals(Configuration.AgentLicenseKey))
158158
throw new Exception("Please set your license key.");

0 commit comments

Comments
 (0)