Azure / Azure/Azure-Functions

Throwing a wrapped exception is not logged correctly (in functions invocation log or appinsights)

Open
#1,142 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
PowerShell
Stars
1.1k
Forks
215
Avg merge
4h 2m
Merged PRs (30d)
1

Description

Hi,

In our functions app we catch any thrown exceptions and throw a new one with additional info which helps us diagnose the issue. This used to be logged correctly within both the monitor log and appinsights, however we now only see the innerexception logged.

So a function that does this:

```
try
{
throw new Exception("inner");
}
catch (Exception exception)
{
throw new Exception("outer", exception);
}
```
results in this in monitor log:

```
DATE (UTC) | MESSAGE | LOG LEVEL
-- | -- | --
2019-03-07 16:30:23.253 | Executing 'Test' (Reason='This function was programmatically called via the host APIs.', Id=64e0047f-1e5a-4cb1-8f83-398f65aef5ab) | Information
2019-03-07 16:30:23.789 | inner | Error
2019-03-07 16:30:23.789 | Executed 'Test' (Failed, Id=64e0047f-1e5a-4cb1-8f83-398f65aef5ab) | Error
2019-03-07 16:30:23.800 | inner | Error
```

As you can see no mention of the outer exception. This makes diagnosing production issues very difficult.

Functions runtime: 2.0.12342.0 (~2)
Region: UKSouth

Thanks for the help

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.