You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: Use structured logging for internal logs (#1903)
* First pass at internal structured logging
* Second pass
* PR feedback
* Strange compile error
* Trying to fix GHA error
* Revert back to original log level
@@ -252,7 +252,7 @@ public void ReportWrapperShutdown(IWrapper wrapper, Method method)
252
252
}
253
253
254
254
Log.Error($"Wrapper {wrapperName} is being disabled for {method.MethodName} due to too many consecutive exceptions. All other methods using this wrapper will continue to be instrumented. This will reduce the functionality of the agent until the agent is restarted.");
255
-
_recurringLogDatas.Add(newRecurringLogData(Log.Debug,$"Wrapper {wrapperName} was disabled for {method.MethodName} at {DateTime.Now} due to too many consecutive exceptions. All other methods using this wrapper will continue to be instrumented. This will reduce the functionality of the agent until the agent is restarted."));
255
+
_recurringLogData.Add($"Wrapper {wrapperName} was disabled for {method.MethodName} at {DateTime.Now} due to too many consecutive exceptions. All other methods using this wrapper will continue to be instrumented. This will reduce the functionality of the agent until the agent is restarted.");
Log.Error($"There was an error initializing the agent: {exception}");
58
+
Log.Error(exception,"There was an error initializing the agent");
59
59
returnDisabledAgentManager;
60
60
}
61
61
catch
@@ -182,7 +182,7 @@ private void Initialize()
182
182
183
183
privatevoidLogInitialized()
184
184
{
185
-
Log.InfoFormat("The New Relic .NET Agent v{0} started (pid {1}) on app domain '{2}'",AgentInstallConfiguration.AgentVersion,AgentInstallConfiguration.ProcessId,AgentInstallConfiguration.AppDomainAppVirtualPath??AgentInstallConfiguration.AppDomainName);
185
+
Log.Info("The New Relic .NET Agent v{0} started (pid {1}) on app domain '{2}'",AgentInstallConfiguration.AgentVersion,AgentInstallConfiguration.ProcessId,AgentInstallConfiguration.AppDomainAppVirtualPath??AgentInstallConfiguration.AppDomainName);
Log.WarnFormat("Unsupported installed .NET Framework version {0} dectected. Please use a version of .NET Framework >= 4.6.2.",AgentInstallConfiguration.DotnetFrameworkVersion);
291
+
Log.Warn("Unsupported installed .NET Framework version {0} dectected. Please use a version of .NET Framework >= 4.6.2.",AgentInstallConfiguration.DotnetFrameworkVersion);
Log.Debug("Shutting down public agent services...");
377
377
StopServices();
378
-
Log.InfoFormat("The New Relic .NET Agent v{0} has shutdown (pid {1}) on app domain '{2}'",AgentInstallConfiguration.AgentVersion,AgentInstallConfiguration.ProcessId,AgentInstallConfiguration.AppDomainAppVirtualPath??AgentInstallConfiguration.AppDomainName);
378
+
Log.Info("The New Relic .NET Agent v{0} has shutdown (pid {1}) on app domain '{2}'",AgentInstallConfiguration.AgentVersion,AgentInstallConfiguration.ProcessId,AgentInstallConfiguration.AppDomainAppVirtualPath??AgentInstallConfiguration.AppDomainName);
Copy file name to clipboardExpand all lines: src/Agent/NewRelic/Agent/Core/Attributes/AttributeValueCollection.cs
+1-1
Original file line number
Diff line number
Diff line change
@@ -286,7 +286,7 @@ public void MakeImmutable()
286
286
}
287
287
catch(Exceptionex)
288
288
{
289
-
Log.Finest($"{attribVal.AttributeDefinition.Classification} Attribute '{attribVal.AttributeDefinition.Name}' was not recorded - exception occurred while resolving value (lazy) - {ex}");
289
+
Log.Finest(ex,"{attribVal.AttributeDefinition.Classification} Attribute '{attribVal.AttributeDefinition.Name}' was not recorded - exception occurred while resolving value (lazy)");
0 commit comments