Configure 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 our application.


If we 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 our 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=8.0.0.0, Culture=neutral, PublicKeyToken=dd3cb1c9aae9ec97" />
               </sharedListeners>
             <trace autoflush="true"/>
         </system.diagnostics>