This may be an extremely stupid question I am new to Azure.
I am using Azure SDK 2.5
I have a worker role deployed to staging on Azure and I'm, using the diagnostics to trace the execution.
Trace.TraceInformation("Service WorkerRole has stopped");
Is there a way to view the WadLogs file that can be viewed in the server explorer from the Azure management portal? Or a way to have the data transferred to blob storage or somewhere else so it can be viewed online?
Basically all I want to easily be able to view when my worker role throws and exception from the Azure management portal.
You can use Application insights to monitor a worker role in the Azure portal. Technically Microsoft is still adding support for console and other non-web apps, but I was able to make what is already there work for my purposes.
I created an Application insight on the portal according to these instructions.
Then using the Nuget package manager in Visual Studio I added the Application insights API, Application insights for website (even though my worker role is not a web app) and the Application insights trace listener.
I then created an Application insight instance by adding the following to the worker role.
using Microsoft.ApplicationInsights;
namespace WorkerRole
{
public class WorkerRole : RoleEntryPoint
{
private TelemetryClient tc = new TelemetryClient();
And then adding this to the onStart method in the worker role.
tc.Context.InstrumentationKey = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX";
You can find you instrumentation key in the Azure portal.
After running or deploying my worker role I could then view all of my Trace.TraceInformation and TraceError statements in the Azure portal as well as add tc.TrackError and tc.TrackEvent statements to track errors, exceptions and events.