'Azure Function exception logging to application insight
Logging to application insight when there is an exception in an Azure function project but only exception message is logged, I want to add custom property
Solution 1:[1]
catch(InvalidStatusCodeException status_ex)
{
log.LogError(status_ex, "Invalid Status code for request: '{ApiUrl}', received code: {ReceivedStatusCode}", status_ex.ApiUrl, status_ex.ReceivedStatusCode);
}
The above log will add ApiUrl and ReceivedStatusCode as custom properties in application insights log.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Thiago Custodio |
