4

So I have tried:

Trace.TraceInformation("Trace.Information Found message on queue");
Debug.WriteLine("Debug Found message on queue"); 
Trace.WriteLine("Trace.WriteLine Found message on queue");
Console.WriteLine("Console.WriteLine Found message on queue");

But neither of them outputs to the Azure portal Web Jobs output log.

What am I missing?

Magnus Johansson
  • 28,010
  • 19
  • 106
  • 164

2 Answers2

3

Later edit: Since the Beta version, the answer below is no longer correct. In order to log messages, you have to use a TextWriter now as shown in these samples: https://github.com/Azure/azure-webjobs-sdk-samples/blob/master/BasicSamples/MiscOperations/Program.cs


Console.WriteLine should work. If that doesn't work, can you please post more code?

For messages written from inside a function, the logs should show up on the function invocation page.

For messages written outside of a function, the logs should show up in the job output log.

Lucas B
  • 11,793
  • 5
  • 37
  • 50
Victor Hurdugaci
  • 28,177
  • 5
  • 87
  • 103
  • Console.WriteLine doesn't work for me either. Tested in Main() and in Function(). That said the "the function invocation page" currently seams to be broken - yesterday I did see the function call statistics and list - today its just a message "Do more with Windows Azure WebJobs SDK. ...". Everything else is working jobs are being triggerd. – archgl Jun 19 '14 at 11:28
  • With the Beta release, we've changed the way logging works. You have to use a TextWriter now as shown in these samples: http://aspnet.codeplex.com/SourceControl/latest#Samples/AzureWebJobs/BasicSamples/MiscOperations/Program.cs – Victor Hurdugaci Jun 19 '14 at 16:12
  • 2
    Is there actual documentation for this? – Michael Teper Apr 21 '15 at 19:45
  • What part of https://github.com/Azure/azure-webjobs-sdk-samples/blob/master/BasicSamples/MiscOperations/Program.cs actually logs anything? – Ryan Gates Aug 12 '15 at 20:16
  • @VictorHurdugaci the link http://aspnet.codeplex.com/SourceControl/latest#Samples/AzureWebJobs/BasicSamples/MiscOperations/Program.cs is broken. It goes to a repository but it doesn't have that file. – Ryan Gates Aug 12 '15 at 20:21
  • The entire source code was moved to GitHub https://github.com/Azure/azure-webjobs-sdk-samples – Victor Hurdugaci Aug 12 '15 at 23:28
3

Console.WriteLine worked for me but log.WriteLine (as per the SDK samples) did not.

Turned out I needed to set the Webjob connection strings in the portal even though I had AzureWebJobsDashboard and AzureWebJobsStorage defined in the App.config.

Neil Thompson
  • 6,356
  • 2
  • 30
  • 53
  • 3
    log.WriteLine is not working for me either (and I **have** those connection strings in the portal!). Console.WriteLine works though. I wish there was some good documentation on the whole TextWriter approach from a new user's perspective. –  Jul 07 '15 at 14:17