Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trace.WriteLine in ASP.NET Azure

when I use

Diagnostics.Trace.WriteLine("message", "Information"); 

in my azure-asp.net this does not show up in my azure compute emulator, but if I do the same from my worker-role it works, any idea why?

Thanks!

like image 771
zebra Avatar asked Dec 21 '10 03:12

zebra


People also ask

What is trace WriteLine?

WriteLine(String) Writes a message to the trace listeners in the Listeners collection. WriteLine(Object, String) Writes a category name and the value of the object's ToString() method to the trace listeners in the Listeners collection.

What is meant by Trace class in Azure?

The Trace class provides properties to get or set the level of Indent and the IndentSize, and whether to AutoFlush after each write.

What is tracing in c#?

Tracing helps to see the information of issues at the runtime of the application. By default Tracing is disabled. Tracing has the following important features: We can see the execution path of the page and application using the debug statement. We can access and manipulate trace messages programmatically.

How to check trace in application Insights?

Go to Application Insights resource in your resource group. Go to Logs under Monitoring section. Click on traces eye button to get log traces. Select Time Range and click Run.


1 Answers

This is with SDK 1.3, right? In 1.3, web roles by default run with full IIS, which means your actual web app code is in a different app domain from your RoleEntryPoint. I believe the compute emulator only shows messages from RoleEntryPoint (WebRole.cs or WorkerRole.cs).

To double check, try putting a trace message in OnStart in WebRole.cs; I'm guessing it will show up.

like image 199
user94559 Avatar answered Sep 24 '22 05:09

user94559