IronPDF 本地異常

This article was translated from English: Does it need improvement?
Translated
View the article in English

在最新版本的 IronPDF 中,日誌中的本地異常訊息將包含一個特定的問題代碼:[問題代碼 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
VB   C#

由 IronPDF 建立的日誌檔通常位於專案的 /bin 目錄,即部署 DLL 的地方,或者您可以設置自訂的 IronPdf.Logging.Logger.LogFilePath,以將日誌檔儲存到特定位置。相關日誌檔包括:

  • Default.log (部署、線程和渲染過程。用於觀察過程行為和異常。)
  • cef.log (Chrome 嵌入式框架進程)

請注意
在較舊版本的 IronPDF 中,創建的日誌文件可能還包括 IronSoftwareEngine.logIronSoftwareEngine.log。當請求工程支援時,請提交所有生成的日誌文件。

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