Search code examples
c#azureazure-compute-emulator

In Azure compute UI why doesn't Trace.WriteLine go to console windows for worker roles? 2.2 SDK


I can't seem to get any output messages to the console windows for any worker roles in Azure Compute Emulator. I'm running Azure SDK 2.2 and I created a fresh Worker role from a template and nothing is printing to the console windows. The only messages I see are about the fabric.

[fabric] Role Instance: deployment22(58).WindowsAzure2.TestWorkerRole.0
[fabric] Role state Started

I've tried Console.WriteLine and Trace.WriteLine and neither work.

using System.Linq;
using System.Net;
using System.Threading;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Diagnostics;
using Microsoft.WindowsAzure.ServiceRuntime;
using Microsoft.WindowsAzure.Storage;

namespace TestWorkerRole
{
    public class WorkerRole : RoleEntryPoint
    {
        public override void Run()
        {
            // This is a sample worker implementation. Replace with your logic.
            Trace.TraceInformation("TestWorkerRole entry point called", "Information");
            Console.WriteLine("Hello World");
            while (true)
            {
                Thread.Sleep(10000);
                Trace.TraceInformation("Working", "Information");
                Console.WriteLine("Inside loop");
            }
        }

        public override bool OnStart()
        {
            // Set the maximum number of concurrent connections 
            ServicePointManager.DefaultConnectionLimit = 12;

            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.

            return base.OnStart();
        }
    }
} 

Solution

  • Turns out I just had to restart my computer after installing the Azure 2.2 SDK.