我正在玩Azure函数,并想了解如何获取更详细的错误消息。Azure函数失败,出现StorageException
函数从队列获取输入,这意味着将有多个并行运行的函数实例。该功能做了一些处理,并通过使用ICollector<>
功能相当频繁要输出到表存储失败例外
Microsoft.Azure.WebJobs.Host.FunctionInvocationException : Exception while executing function: Functions.LoadActivityDetail
---> System.InvalidOperationException : Error while handling parameter outputTable after function returned:
---> Microsoft.WindowsAzure.Storage.StorageException : Element 0 in the batch returned an unexpected response code.
我可以从日志此异常,但我想获得更多一些细节如上所述“Unexpected Response Code for Operation: 0” when executing Azure Table Storage batch delete。
问题是我无法捕捉代码中的异常,因为绑定是在azure函数运行时完成的。
有没有办法如何启用一些更详细的日志记录?
通常表存储提供调试足够的信息,你只需要看看异常的附加字段,则不需要“启用”任何额外的日志。据我所知,异常中有Response属性,其中包含更多信息。 – cassandrad
确实如此,例外情况会有细节。但如果使用表存储绑定,则情况会有所不同。函数代码不直接插入到表存储中,它只是准备数据,而Azure函数运行时将尝试插入并失败。 – mybrave