سؤال

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?>

هل كانت مفيدة؟

المحلول

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.

Example:

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top