Configuring trace for SSLStream

To capture tracing events and messages relating to the SSLStream class, you must add a configuration section for system diagnostics to the application configuration file for your application.

About this task

Note:

This task applies to IBM® MQ classes for .NET Framework only. The application configuration file is not supported in IBM MQ classes for .NET (.NET Standard and .NET 6 libraries).

If you do not add a configuration section for system diagnostics to the application configuration file, the IBM MQ managed .NET client will not capture any events, traces or debugging points relating to TLS and the SSLStream class.

Note: Starting IBM MQ tracing using strmqtrc does not capture all the required TLS tracing.

Procedure

  1. Create an application configuration (App.Config) file for your application project.
  2. Add a system diagnostics configuration section as shown in the following example.
    <system.diagnostics>
               <sources>
                     <source name="System.Net" tracemode="includehex">
                           <listeners>
                                 <add name="ExternalSourceTrace"/>
                           </listeners>
                     </source>
                     <source name="System.Net.Sockets">
                           <listeners>
                                 <add name="ExternalSourceTrace"/>
                           </listeners>
                     </source>
                     <source name="System.Net.Cache">
                           <listeners>
                                 <add name="ExternalSourceTrace"/>
                           </listeners>
                     </source>
                     <source name="System.Net.Security">
                           <listeners>
                                 <add name="ExternalSourceTrace"/>
                           </listeners>
                     </source>
                     <source name="System.Security">
                           <listeners>
                                 <add name="ExternalSourceTrace"/>
                           </listeners>
                     </source>
               </sources>
               <switches>
                     <add name="System.Net" value="Verbose"/>
                     <add name="System.Net.Sockets" value="Verbose"/>
                     <add name="System.Net.Cache" value="Verbose"/>
                     <add name="System.Security" value="Verbose"/>
                     <add name="System.Net.Security" value="Verbose"/>
               </switches>
               
               <sharedListeners>
                     <add name="ExternalSourceTrace" type="IBM.WMQ.ExternalSourceTrace, amqmdnet, Version=n.n.n.n, Culture=neutral, PublicKeyToken=dd3cb1c9aae9ec97" />
               </sharedListeners>
             <trace autoflush="true"/>
         </system.diagnostics>
    
    Attention: The Version field of the add name entry needs to be whichever version of the .net amqmdnet.dll file that is being used.