3
votes

If I use NLog with the Adapter for Azure Application Insights, how do I send properties?

When I am browsing through these logs in VS or the Azure Portal I'd like to be able to group or filter them.

Is there a way to name them? Or to pass some properties or metrics?

1

1 Answers

4
votes

Custom properties support was added when resolving this issue: https://github.com/Microsoft/ApplicationInsights-dotnet-logging/issues/5 If you check pull request for this issue you can see how it is tested with a unit test:

Logger aiLogger = this.CreateTargetWithGivenInstrumentationKey();
var eventInfo = new LogEventInfo(LogLevel.Trace, "TestLogger", "Hello!");  
eventInfo.Properties["Name"] = "Value";  
aiLogger.Log(eventInfo);  

When you look at the details blade for that trace message you will find "Name" property there.