0

I have created an Azure Function in Go. The function is working properly in local machine & also when published. But, i don't see any logs from my Go program.

I have tried with both fmt.Println & log.Println statements.

With Log level set as Verbose, i see this:

2020-07-29T17:36:28Z   [Information]   Executing 'Functions.hello' (Reason='This function was programmatically called via the host APIs.', Id=fe98c5c5-de79-4091-8cd8-e1479020c9d5)
2020-07-29T17:36:28Z   [Verbose]   Sending invocation id:fe98c5c5-de79-4091-8cd8-e1479020c9d5
2020-07-29T17:36:28Z   [Verbose]   Will invoke simple httpTrigger function: 'hello' invocationId: 'fe98c5c5-de79-4091-8cd8-e1479020c9d5'
2020-07-29T17:36:28Z   [Verbose]   Sending http request message for simple httpTrigger function: 'hello' invocationId: 'fe98c5c5-de79-4091-8cd8-e1479020c9d5'
2020-07-29T17:36:28Z   [Verbose]   Received http response for simple httpTrigger function: 'hello' invocationId: 'fe98c5c5-de79-4091-8cd8-e1479020c9d5'
2020-07-29T17:36:28Z   [Information]   Executed 'Functions.hello' (Succeeded, Id=fe98c5c5-de79-4091-8cd8-e1479020c9d5, Duration=10ms)

my host.json file has following logging related configuration:

{
    "version": "2.0",
    "logging": {
        "applicationInsights": {
            "samplingSettings": {
                "isEnabled": true,
                "excludedTypes": "Request"
            },
            "httpAutoCollectionOptions": {
                "enableHttpTriggerExtendedInfoCollection": true
            }
        },
        "fileLoggingMode": "always",
        "logLevel": {
            "default": "Trace",
            "Host": "Trace",
            "Function": "Trace",
            "Host.Aggregator": "Trace"
        },
        "console": {
            "isEnabled": true
        }
    },
    "httpWorker": {
        "description": {
            "defaultExecutablePath": "hello.exe"
        }
    },
    "extensionBundle": {
        "id": "Microsoft.Azure.Functions.ExtensionBundle",
        "version": "[1.*, 2.0.0)"
    }
}

My code is hosted in github here: https://github.com/mpurusottamc/azurefunc-go

Am i missing something?

Purusottam
  • 611
  • 6
  • 19
  • 1
    You should be able to see them in Application Insights traces under the category `Host.Console`. – Anthony Chu Jul 30 '20 at 02:22
  • Thanks @AnthonyChu I see the logs in the Application Insights. However, there's a delay of almost 5 mins before the logs show up. – Purusottam Jul 31 '20 at 00:19

0 Answers0