This is an asp.net application using framework 4.7.
I'm attempting to attach to the Microsoft.IdentityModel.Logging.IdentityModelEventSource.Logger in an asp.net application (I'm using OpenIdConnect in an OWIN startup class, I am having problems and am hoping that attaching to this logger might give me some clues).
In my OWIN Startup class, in the Configuration() method, I have the following:
Microsoft.IdentityModel.Logging.IdentityModelEventSource.Logger.LogLevel = System.Diagnostics.Tracing.EventLevel.Verbose;
Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true;
var listener = new EventListener();
listener.EnableEvents(Microsoft.IdentityModel.Logging.IdentityModelEventSource.Logger, EventLevel.LogAlways);
listener.EventWritten += Listener_EventWritten;
Microsoft.IdentityModel.Logging.IdentityModelEventSource.Logger.WriteVerbose("A test message.");
And in my Listener_EventWritten method I have the following:
private void Listener_EventWritten(object sender, EventWrittenEventArgs e)
{
Debug.WriteLine(e.EventName + "," + e.Message);
}
This method fires a bunch of times, but "e.Message" is always null. What am I doing wrong?