【发布时间】:2017-08-17 09:56:59
【问题描述】:
我正在使用 Azure 函数,希望更深入地了解如何获取更详细的错误消息。
函数从 queue 获取输入,这意味着将有多个函数实例并行运行。该函数进行了一些处理并希望通过使用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。
问题是我无法在代码中捕获异常,因为绑定是在天蓝色函数运行时完成的。
有没有办法启用一些更详细的日志记录?
【问题讨论】:
-
通常表存储提供了足够的调试信息,您只需要查看异常中的其他字段,您不需要“启用”任何额外的日志记录。据我记得,异常中有 Response 属性包含更多信息。
-
没错,异常会有细节。但是如果使用了表存储绑定就不同了。函数代码不是直接插入到表存储中,它只是准备数据,Azure函数运行时会尝试插入并失败。
标签: azure azure-functions azure-table-storage