Question

SpecWin on Fri, 08 Mar 2019 16:19:19


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 use to work in 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:

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

Functions runtime: 2.0.12342.0 (~2)
Region: UKSouth

Thanks for the help

Replies

KetanChawda-MSFT on Tue, 12 Mar 2019 04:18:24


To Log the Error in Application Insights you can write it as shown below:

try
{
   throw new Exception("inner");
}
catch(Exception exception)
{
   log.LogError("outer" + exception);
}

Monitor Log:


KetanChawda-MSFT on Fri, 15 Mar 2019 05:20:37


Hello SpecWin,

Any update on this ?