IronPDF 中的本地异常处理

2022年一月19日
更新 2024年十月20日
分享:
This article was translated from English: Does it need improvement?
Translated
View the article in English

在最近版本的IronPDF中,日志中的本机异常消息将包含一个特定的问题代码:[Issue Code IRONPDF-NATIVE-EXCEPTION]。 以下展示了此类异常消息的一个示例:

IronPdf.Exceptions.IronPdfNativeException: Error while generating PDF from HTML: 'Error while rendering pdf from html for job group 0: 'Error during dev tools execution: {"method":"Inspector.targetCrashed","params":{}}''.
2024-01-25 08:12:11,960 INFO  [Thread-3] [, , , , , , , , ] c.i.i.i.s.Access: [IronPdfEngine]To learn how to solve this issue please read https://ironpdf.com/troubleshooting/ironpdf-native-exception [Issue Code IRONPDF-NATIVE-EXCEPTION]

可能原因

IronPDF原生异常通常源于IronPdf.Native.Chrome包中使用的C++代码的各种问题,该包是IronPDF的一个依赖项,涉及使用Chrome PDF渲染引擎。

解决方案

若需协助处理与本机异常相关的问题,请提交工程支持请求,并提供完整的日志文件以便进一步调查。

在您的项目中包括以下代码片段以启用本地日志记录:

IronPdf.Logging.Logger.LogFilePath = "Default.log"; //May be set to a directory name or full file

IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.All;
IronPdf.Logging.Logger.LogFilePath = "Default.log"; //May be set to a directory name or full file

IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.All;
IronPdf.Logging.Logger.LogFilePath = "Default.log" 'May be set to a directory name or full file

IronPdf.Logging.Logger.LoggingMode = IronPdf.Logging.Logger.LoggingModes.All
$vbLabelText   $csharpLabel

IronPDF创建的日志文件通常位于项目的/bin目录中,您的DLL部署在此处,或者您可以设置自定义IronPdf.Logging.Logger.LogFilePath以将日志文件存储在特定位置。 相关日志文件包括:

  • Default.log(部署、线程和渲染过程。 对观察过程行为和异常很有用。
  • cef.log(Chrome 嵌入式框架进程)

    [{i:(在较旧版本的IronPDF中,创建的日志文件可能还包括IronSoftwareEngine.logIronSoftwareEngine.log。 请提交在请求工程支持时生成的所有日志文件。

    对于云服务器,日志文件可能位于特定目录中。 请参考我们的指南以生成 AzureAWS 中的日志文件。