Currently we are preapring a set of azure functions
to trigger a blob storage
. The function app V3 should do some kind of checks on startup. So I added the Startup.cs
file in the VS solution. The problem what I'm having is that sometimes exceptions happen while performing these checks in the startup file. But I never find these exceptions in azure portal (application insights/exceptions)
. I tried many ways to implement logging there, but unfortunately the app keeps saying Host is not running
without any logging in these logs:
I'm not talking about the logs of a specific function, I mean here the logs of the function app on startup.
This is the code where it throws the exception in startup.cs
:
try
{
// async method CheckSomeBlobsFiles
CheckSomeBlobsFiles(connectionString,
blobContainerName, blobDirectoryName).GetAwaiter().GetResult();
}
catch (Exception e)
{
throw new Exception($"Error while checking database schemas: {e.Message}");
}
After some research, for the exceptions from Startup.cs
, you can find it in azure portal -> Diagnose and solve problems blade.
The steps as beow:
1.Nav to azure portal -> your function app -> on the left side, click on Diagnose and solve problems -> then input function app down in the search box -> then click on the Function App Down or Reporting Errors. The screenshot as below:
2.In the new page of Function App Down or Reporting Errors, expand Function Executions and Errors -> then expand Detected host offline in your function app. Then you can see the exceptions in the startup.cs are logged there(if it's not there, please specify a proper time range on this page). The screenshot as below: