Forums, Documentation & Knowledge Base - ComponentSpace

Enabling SAML Trace


https://www.componentspace.com/Forums/Topic7936.aspx

By ComponentSpace - 5/26/2017

SAML debug trace may be enabled to assist with tracking down issues.
The standard ASP.NET Core logging API is used.
In our examples, we make use of Serilog. However, any logging provider may be used to capture the logging information.
Regardless of the logging provider used, the "Debug" level must be specified for "ComponentSpace".
However, it's not recommended to enable SAML debug trace in production environments, unless for problem determination, as it may impact performance.
The following is an example Serilog configuration in appsettings.json. Logs are written to a "logs" folder under the application's root folder.


"Serilog": {
  "MinimumLevel": {
    "Default": "Warning",
    "Override": {
      "ComponentSpace": "Debug"
    }
  },
  "WriteTo": [
    {
      "Name": "Debug"
    },
    {
      "Name": "Async",
      "Args": {
         "configure": [
           {
             "Name": "File",
             "Args": {
               "path": "logs/saml-.log",
               "rollingInterval": "Day",
               "retainedFileCountLimit": 7,
               "buffered": true,
               "flushToDiskInterval": "00:00:01"
             }
           }
         ]
       }
     }
   ]
}



To support Serilog and the above configuration, the following NuGet packages must be included in the application.


Serilog.AspNetCore
Serilog.Sinks.Async
Serilog.Sinks.File



The following example CreateWebHostBuilder method in the Program class removes the default logging providers and adds the Serilog provider.


public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
  WebHost.CreateDefaultBuilder(args)
   .ConfigureLogging(configureLogging => configureLogging.ClearProviders())
   .UseSerilog((webHostBuilderContext, loggerConfiguration) =>
      loggerConfiguration.ReadFrom.Configuration(webHostBuilderContext.Configuration))
   .UseStartup<Startup>();


By ComponentSpace - 11/4/2019

You're welcome.