首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 編程語言 >  >> .NET 網頁程式設計 >> ASP.NET 基礎 >> 關於ASP.NET

ELMAH 開源日誌組件實戰:熱插拔、多目標記錄與 RSS 查看零代碼整合

     編輯:關於ASP.NET

ELMAH 特色

  • 熱插拔:零程式碼修改,僅配置即可啟用。
  • 多目標:資料庫、檔案、Email 同步記錄。
  • 多資料庫:支援 Access、SQL Server、Oracle、SQLite、VistaDB。
  • 內建檢視:Web 頁面 + RSS 訂閱,無需自行開發後台。

整合三步驟

  1. 下載 ELMAH-1.0-BETA3,引用 Elmah.dll(支援 .NET 1.0~3.5)。
  2. 執行資料庫腳本(如 SQLServer.sql),建立 ELMAH_Error 資料表。
  3. 修改 Web.config:
<configSections>
  <sectionGroup name="elmah">
    <section name="security" type="Elmah.SecuritySectionHandler, Elmah" requirePermission="false" />
    <section name="errorLog" type="Elmah.ErrorLogSectionHandler, Elmah" requirePermission="false" />
    <section name="errorMail" type="Elmah.ErrorMailSectionHandler, Elmah" requirePermission="false" />
    <section name="errorFilter" type="Elmah.ErrorFilterSectionHandler, Elmah" requirePermission="false" />
  </sectionGroup>
</configSections>

<elmah>
  <security allowRemoteAccess="0" />
  <errorLog type="Elmah.XmlFileErrorLog, Elmah" logPath="E:\LogHaHa\" />
</elmah>

以上配置將錯誤以 XML 檔案形式儲存於 E:\LogHaHa\,禁止遠端存取。若需資料庫記錄,將 errorLog type 改為 Elmah.SqlErrorLog 並設定連線字串即可。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved