Logging from ASP.NET 5 application hosted as Azure Web App : <p>I have an ASP.NET 5 Web API that I host in Azure as a Web App. I want to log messages from my code using Azure Diagnostics. There are multiple article including <a href="https://azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-troubleshoot-visual-studio/#apptracelogs" rel="noreferrer">Azure docs</a> that suggest that it should be as easy as <code>System.Diagnostics.Trace.WriteLine</code> once enabled. The logs should show up under <code>LogsFiles/Application</code> and in log stream in Azure.</p>

<p>I enabled application logging for the web app:</p>

<p><a href="https://i.stack.imgur.com/P0cjl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/P0cjl.png" alt="enter image description here"></a></p>

<p>But the following calls produces no logs:</p>

<pre><code>System.Diagnostics.Trace.TraceError("TEST");
System.Diagnostics.Trace.TraceInformation("TEST");
System.Diagnostics.Trace.TraceWarning("TEST");
System.Diagnostics.Trace.WriteLine("TEST");
</code></pre>

<p>I tried to manually define <code>TRACE</code> symbol, but with no luck:</p>

<p><a href="https://i.stack.imgur.com/lp1N8.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lp1N8.png" alt="enter image description here"></a></p>

<p>I also tried to use the new <code>Microsoft.Extensions.Logging</code> framework and use <code>ILogger.Log</code> API, but without any results again:</p>

<pre><code>public void Configure(IApplicationBuilder app, 
                      IHostingEnvironment env, 
                      ILoggerFactory loggerFactory)
{
    loggerFactory.MinimumLevel = LogLevel.Debug;

    var sourceSwitch = new SourceSwitch("Sandbox.AspNet5.ApiApp-Demo");
    sourceSwitch.Level = SourceLevels.All;
    loggerFactory.AddTraceSource(sourceSwitch, 
                                 new ConsoleTraceListener(false));
    loggerFactory.AddTraceSource(sourceSwitch, 
                                 new EventLogTraceListener("Application"));
}
</code></pre>

<p>Any ideas on what am I doing wrong?</p>
