In my Win10 UWP app, I am using The FileLoggingSession to log various events in my app. I would like to make use of LoggingFields to add custom fields to my log message.
We are using Microsoft Message Analyzer to view the logs. However, the custom fields get displayed all garbled.
Here is the code I am using for custom fields:
var channel = new LoggingChannel("MyChannel");
var fields = new LoggingFields();
fields.AddString("Source", Source);
fields.AddString("Class", LogClass);
fields.AddString("Message", Message);
channel.LogEvent("MyEvent", fields, LoggingLevel.Information);
When I read the log via Message Analyzer and then export to csv this is an example of what I see in my source field GetPolicy()çŒ®ãŽ¬ä €é€†à¾
where it should just be GetPolicy()
.
However if I use tracerpt to extract the information to xml it does come out correct: <Data Name="Source">GetPolicy()</Data>