Enabling SAML for ASP.NET Trace

The SAML component may be configured to enable SAML trace to be written to a log file. This information can assist with tracking down issues.

It is not recommended that SAML trace is left enabled in production systems as this may have an impact on performance.

Configure SAML Trace

Update your application’s web.config to include a <system.diagnostics> section as shown in the configuration below.

Log files are written to the logs sub-folder under your application’s root folder.

<system.diagnostics>
    <trace autoflush="true">
      <listeners>
         <add name="CyclicTextWriter"/>
      </listeners>
    </trace>
    <sources>
      <source name="ComponentSpace.SAML2" switchValue="Verbose">
        <listeners>
          <add name="CyclicTextWriter"/>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <!-- Ensure IIS has create/write file permissions for the log folder. -->
      <add 
        name="CyclicTextWriter"  
        type="ComponentSpace.SAML2.Utility.CyclicTraceListener,ComponentSpace.SAML2" 
        initializeData="logs"/>
    </sharedListeners>
 </system.diagnostics>

The switchValue should be set to “Verbose” in production systems for problem determination only. Otherwise, it should be set to either “Off” or “Information”.