Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Path to agentinfo.json was built incorrectly, leading to file not found errors when running on Linux. (#2156) #2157

Merged
merged 6 commits into from
Dec 21, 2023
Merged
8 changes: 5 additions & 3 deletions src/Agent/NewRelic/Agent/Core/AgentInstallConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,19 +200,21 @@ private static string GetNewRelicLogLevel()

public static AgentInfo GetAgentInfo()
{
var agentInfoPath = $@"{NewRelicHome}\agentinfo.json";
var agentInfoPath = Path.Combine(NewRelicHome, "agentinfo.json");

if (File.Exists(agentInfoPath))
{
try
{
return JsonConvert.DeserializeObject<AgentInfo>(File.ReadAllText(agentInfoPath));
}
catch
catch (Exception e)
{
// Fail silently
Log.Debug(e, $"Could not get agent info from {agentInfoPath}.");
}
}

Log.Debug($"Could not get agent info from {agentInfoPath}. File does not exist.");
return null;
}
}
Expand Down
Loading