How to capture OWIN logs in Azure App Service

1 minute read | By Sree Vani Koneru & Isabel Chavarria & Jafet Chaves

How to capture OWIN logs in Azure App Service

Here are the steps to capture Owin Logs from your Azure Website:

  1. Go the Azure Portal and go to your App Service and then open the KUDU console as shown below: flow

  2. You can also open the KUDU console of your website by navigating to the SCM site directly, for example *http://.scm.Azurewebsites.net** (replace* with your website name)

    flow

  3. Once you are inside the KUDU console, go to Debug Console and then CMD as shown below:

    flow

  4. Once you are inside the CMD go to the site folder and then wwwroot folder, as shown below:

    flow

  5. Once you are within the wwwroot folder, locate the web.config file and click the pencil icon to edit the file:

    flow

    Please place the below code as a separate section in the web.config

      
                     <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="d:\home\logfiles\Katana.trace.log"
                     traceOutputOptions="ProcessId, DateTime"/>
                         </sharedListeners>
                         <switches>
                           <add name="Microsoft.Owin" value="Verbose"/>
                         </switches>
                       </system.diagnostics> 
    
  6. Once you have saved the web.config file, restart the website from the Azure Portal:

flow