1

I'm using a consumption plan Linux Function, published using VS. Everything works locally, but for some reason I can't see any logs when I deploy it.

I tried 'Log Stream - Application Insights', nothing there except some framework logs...

i.e.:

2020-09-22T04:14:59Z   [Verbose]   Poll for function 'EmailQueueWorker' on queue 'email' with ClientRequestId '6106f3ec-52b6-4b0d-b525-887383a6fb12' found 0 messages in 4 ms.

I can't access SCM (no support for Linux on consumption plan)...

This is my 'host.json' configuration:

{
  "logging": {
    "fileLoggingMode": "always",
    "logLevel": {
      "default": "Information",
      "Host.Results": "Error",
      "Function": "Trace",
      "Host.Aggregator": "Trace"
    },
    "applicationInsights": {
      "samplingExcludedTypes": "Request",
      "samplingSettings": {
        "isEnabled": true
      }
    },
    "console": {
      "isEnabled": "true"
    }
  },
  "Values": {
    "AzureWebJobsStorage": "******",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet"
  },
  "version": "2.0"
}

This is my code:

 [FunctionName("EmailQueueWorker")]
        public static async Task Run(
            [QueueTrigger(queueName: "email", Connection = "AzureWebJobsStorage")] string queueItem,
            ILogger log
        )
        {
            log.LogTrace($"Handling: {queueItem}");
        }

I do occasionally find exceptions (it takes a lot of time) in the "Log" query results, but most of the time it doesn't work at all (no exceptions caught) or takes a lot of time to get there.

Thanks

Joy
  • 1,171
  • 9
  • 15
NOP-MOV
  • 792
  • 2
  • 8
  • 28
  • Could you try and replace `Function` with your actual function's name and namespace, e.g. `FunctionApp.Some.Namespace.EmailQueueWorker`, and also declare it before declaring `default`? – Kristin Sep 22 '20 at 08:28
  • I am seeing some traces in 'Log' queries > 'Traces', BUT, they are late and only partial, my program probably exists with some exception which I can't simply find anywhere, it's like developing blindly without any debugging options. – NOP-MOV Sep 22 '20 at 10:35
  • You mention application insights, so I take it that it is enabled for your app. Have you tried the "Search" section? It tends to be easier to locate the actual exceptions, and you can then navigate from the results into the exception, and see what happened before the exception (the execution tree should be available). – Kristin Sep 22 '20 at 12:01
  • Did you check App Insights exceptions for your app: exceptions | order by timestamp | where cloud_RoleName contains "myfunctionname" – Markus Meyer Sep 22 '20 at 14:14
  • OK. so for some reason I can't see any exceptions from my app written into Application Insights, but traces are now working. Super hard when you can't debug/see exceptions but I simply wrapped all exceptions and wrote them to the trace. – NOP-MOV Sep 23 '20 at 18:21

0 Answers0