Azure / azure-functions-dotnet-worker

Azure Functions out-of-process .NET language worker
MIT License
432 stars 184 forks source link

ILogger.LogError produces empty line in "monitor" panel #785

Open WinInsider opened 2 years ago

WinInsider commented 2 years ago

The "Exception" argument of ILogger.LogError(...) method produces empty line in "monitor" panel in Azure Portal, instead printing out exception stack trace.

Example

brettsam commented 2 years ago

@WinInsider -- can you share exactly which overload you're using here?

WinInsider commented 2 years ago

Invoked via this) extension method

Eg: logger.LogError(e, "Failed to save record");

What comes out in "monitor" panel (in Azure Portal) is two lines, first one is blank, second line would have "Failed to save record". Without details in first line as to the exception that has occurred.

kshyju commented 2 years ago

@WinInsider Do you see the same empty line entry when you query the app insights logs/tables?

WinInsider commented 2 years ago

Yes same,

image

image

However, the error details can be found in App Insights blade/area, under "Failures/Exceptions"... the downside is that is not easy to corollate the exception if there are many errors.

Prehaps is worth noting the type of exception, AggrigatedException, as a result of async/await operation. Maybe there is a difference in the way the new azure function sdk handles AggrigatedException.

kshyju commented 2 years ago

Thanks! I was able to repro this issue. It seems like a glitch in the JOIN query used to render the monitor tab data. If you query the raw data (traces or exceptions tables), you will not see an empty entry logged. Will follow up with the team and share an update here and the next steps to fix it.

cc @brettsam

brettsam commented 2 years ago

cc @spellegrino021, @takyyon -- looks like we need to tune the query that we generate here. The data is there, it just gets lost in the union.

The details are above, but @kshyju has a repro that he should be able to share too.

WinInsider commented 2 years ago

Have run app insights query against exceptions however, there is no "message" element/property thus still comes up empty/blank for me.

I have notice this behavior only after switching to new Azure Function Worker SDK (Microsoft.Azure.Functions.Worker)

Could it be the case that message on this line is null or empty?

fabiocav commented 1 year ago

@mattchenderson , we need to follow up with the UX folks on this.

stevencreaney commented 10 months ago

Is there any progress on this? or a workaround to get the Exceptions logged properly in the Monitor view?

djfoz commented 8 months ago

I'm also encountering this issue.

anudeeparavapalli commented 4 months ago

Hi, is this issue solved?