Skip to content

Debugging

Chris R edited this page Feb 8, 2017 · 2 revisions

How do I Debug my Katana based app or framework?

There are several tools available to help you debug your application.

Diagnostics

The Microsoft.Owin.Diagnostics nuget package contains a welcome page and an error page. The UseWelcomePage extensions can be used to add a simple html page to your application to verify the site is up and running. The UseErrorPage extensions can be used to add an Exception filter to the request pipeline that will display exception and request details.

Debug Symbols

Starting with v2.0.0 Katana's debug symbols are now being published to symbolsource.org (instructions). The nightly dev and nightly release symbols are also available.

Logging

The Katana servers and middleware log errors to the .NET trace infrastructure by default. Components log under their full name, including namespace, so logs can be enabled per component, per namespace, or globally for everything in the Microsoft.Owin namespaces. By default logs are sent to the Visual Studio output console during debugging. Here's how to also direct them to a file:

  <system.diagnostics>
    <trace autoflush="true" />
    <sources>
      <source name="Microsoft.Owin">
        <listeners>
          <add name="KatanaListener"/>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add
       name="KatanaListener"
       type="System.Diagnostics.TextWriterTraceListener"
        initializeData="Katana.trace.log"
       traceOutputOptions = "ProcessId, DateTime"
                />
    </sharedListeners>
    <switches>
      <add name="Microsoft.Owin" value="Verbose" />
    </switches>
  </system.diagnostics>
Clone this wiki locally