IronPDF 中的本機例外處理

2022年1月19日
已更新 2024年10月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 生成的日誌檔案通常位於您的專案中部署 DLL 的/bin 目錄,或者您可以設置自定義的 IronPdf.Logging.Logger.LogFilePath,將日誌檔案存儲在特定位置。 相關的日誌文件包括:

  • Default.log(部署、執行緒和渲染過程。 有助於觀察過程行為和例外情況。
  • cef.log(Chrome嵌入式框架進程)

    [{i:(在較舊版本的IronPDF中,創建的日誌文件也可能包含IronSoftwareEngine.logIronSoftwareEngine.log。 請提交所有在申請工程支持時生成的日誌檔案。

    對於雲端伺服器,日誌文件可能位於特定目錄中。 請參考我們的指南來生成AzureAWS日誌文件。