Use single Elmah.axd for multiple applications with single DB log

前端 未结 3 1591
有刺的猬
有刺的猬 2021-02-02 09:44

We have a single SQL Log for storing errors from multiple applications. We have disabled the elmah.axd page for each one of our applications and would like to have a new applic

3条回答
  •  囚心锁ツ
    2021-02-02 10:21

    I assume by "SQL Log" you mean MSSQL Server... If so, probably the easiest way of accomplishing what you want would be to edit the stored procedures created in the SQL Server database that holds your errors.

    To get the error list, the ELMAH dll calls the ELMAH_GetErrorsXML proc with the application name as a parameter, then the proc filters the return with a WHERE [Application] = @Application clause.

    Just remove the WHERE clause from the ELMAH_GetErrorsXML proc, and all errors should be returned regardless of application.

    To get a single error record properly, you'll have to do the same with the ELMAH_GetErrorXML proc, as it also filters by application.

    This, of course, will affect any application retrieving errors out of this particular database, but I assume in your case you'll only ever have the one, so this should be good.

    CAVEAT: I have not tried this, so I can't guarantee the results...

提交回复
热议问题