Skip to content

Commit bd7e0c3

Browse files
authored
fix: Path to agentinfo.json was built incorrectly, leading to file not found errors when running on Linux. (#2156) (#2157)
1 parent b392701 commit bd7e0c3

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/Agent/NewRelic/Agent/Core/AgentInstallConfiguration.cs

+12-3
Original file line numberDiff line numberDiff line change
@@ -200,18 +200,27 @@ private static string GetNewRelicLogLevel()
200200

201201
public static AgentInfo GetAgentInfo()
202202
{
203-
var agentInfoPath = $@"{NewRelicHome}\agentinfo.json";
203+
if (string.IsNullOrEmpty(NewRelicHome))
204+
{
205+
Log.Debug($"Could not get agent info. NewRelicHome is null or empty.");
206+
return null;
207+
}
208+
209+
var agentInfoPath = Path.Combine(NewRelicHome, "agentinfo.json");
210+
204211
if (File.Exists(agentInfoPath))
205212
{
206213
try
207214
{
208215
return JsonConvert.DeserializeObject<AgentInfo>(File.ReadAllText(agentInfoPath));
209216
}
210-
catch
217+
catch (Exception e)
211218
{
212-
// Fail silently
219+
Log.Debug(e, $"Could not deserialize agent info from {agentInfoPath}.");
213220
}
214221
}
222+
else
223+
Log.Debug($"Could not get agent info from {agentInfoPath}. File does not exist.");
215224

216225
return null;
217226
}

0 commit comments

Comments
 (0)