0

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.

nastassiar
  • 1,545
  • 2
  • 24
  • 43
  • Trace and logging information is a structured information and hence are saved into WADLogsTable table in table storage. Does it really makes sense to transfer them to blob storage which is meant for unstructured data or binary files? As far as viewing any azure storage data we always have to use a client application. Online web portal doesn't support viewing data of any type of azure storage be it blobs, queues or table. – RBT Jun 19 '15 at 07:40

2 Answers2

2

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.

nastassiar
  • 1,545
  • 2
  • 24
  • 43
0

You need to setup a storage account with your worker role to store the logs in a Table Storage. Add the following code in your config file <ConfigurationSettings> <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="value="DefaultEndpointsProtocol=https;AccountName=<your storage account name here>;AccountKey=<your storage account key here>" /> </ConfigurationSettings>

Your diagnostics related data will be stored in the azure tables and Trace logs are stored in the table name WadLogsTable. You need to use a storage explorer to view the logs from the table. I prefer to use Azure Storage Explorer as it is open source and supports Blobs,Tables and Queues.

  • I already have this set up I can already view the Trace logs in the Server Explorer view of Visual studio what I want is a way to view these logs in the Azure management portal. – nastassiar Apr 30 '15 at 19:08
  • It's not directly possible to view the logs in the Azure Management portal. – Mohit chhabra Apr 30 '15 at 19:24