Log info to azure webjobs log files?


I havent found info in how to log something in the azure logs, I suppose sdk should allow this, if its possible can you provide a small example or link?>

By : Esteban V


If you are using the WebJobs SDK then we redirect the standard output stream so if you write to console it should also write to logs.


Console.WriteLine("Log message");

I've not tried this yet but I would think it should be possible to get NLog working in a WebJob.

I could imagine two log targets being configured, one of type ColoredConsole and another of type File. ColoredConsole runs in debug and release mode (when deployed to Azure) and any messages would be directed to log output and viewable in Kudu. The File target could be turned off in Release mode but available when running locally in development.

NLog loggers can be turned off by setting minLevel="Off" in a .config transform file.

This video can help you solving your question :)
By: admin