Azure Functions in Visual Studio - PATH to log files?

Viewed 585

Using Visual Studio 2019 Community (on Windows 10) to create an Azure HTTP Timer trigger using C# -- code is IDENTICAL to that shown at: https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer?tabs=csharp#example

I am able to run the project (locally) without issue.

Question:

I cannot find any documentation as to the actual PATH the "logger" is using when writing to the log while running locally in Visual Studio. For example is a log file or (database) located somewhere in the project directory or on C:\somewhere? Does anyone know where to find the log file / database? There seems to be no method or property in the logger interface that exposes this information.

Also - perhaps there is some sort of "path" setting that needs to be configured in the "local.settings.json" file?

Thanks in advance.

1 Answers

Set "fileLoggingMode": "always" in host.json:

{
  "version": "2.0",
  "logging": {
    "fileLoggingMode": "always",
    "applicationInsights": {
      "samplingSettings": {
        "isEnabled": true,
        "excludedTypes": "Request"
      }
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[1.*, 2.0.0)"
  }
}

Then go to C:\Users\yourusernameonlocal\AppData\Local\Temp\LogFiles\Application\Functions\Function\yourfunctionname

Related