ELMAHをSharePoint環境に統合した人はいますか?
すべてASP.netなので可能だと思いますが、誰かがそれをやったのか、それを実現する方法についてのウォークスルーがあるのだろうかと思いました。
ELMAHをSharePoint環境に統合した人はいますか?
すべてASP.netなので可能だと思いますが、誰かがそれをやったのか、それを実現する方法についてのウォークスルーがあるのだろうかと思いました。
ELMAH、またはSharepointのほとんどのHTTPModuleを設定するときに重要なことの1つは、httpModulesセクションの先頭にある必要があるということです。そうしないと、SharePointは基本的に例外を飲み込み、ELMAH機能は呼び出されません。
作品
<clear />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"/>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/>
<add name="SPRequest" type="Microsoft.SharePoint.ApplicationRuntime.SPRequestModule, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
... Rest of SharePoint modules....
動作しません
<clear />
<add name="SPRequest" type="Microsoft.SharePoint.ApplicationRuntime.SPRequestModule, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule" />
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" />
... Rest of SharePoint modules....
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"/>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/>
MOSS2007環境ではELMAHを使用しています。ELMAHはHttpHandlersを使用し、web.configを介して設定されるため、それをアクティブ化するのは簡単でした。SharePoint内で実行しているアプリケーションのweb.configにELMAHのものを追加するだけです。
ELMAHでカスタムアプリケーションよりも高いレベルでエラーを報告する場合は、それをSharePointweb.configに追加します。
魔法はありません。他のASP.NETサイトと同じように接続するだけです。
以下は、SharePointWebアプリケーションのweb.configに追加する必要のある構成エントリです。
configsectionの下に追加
<configSections>
<sectionGroup name="elmah">
<section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah" />
<section name="errorLog" requirePermission="false" type="Elmah.ErrorLogSectionHandler, Elmah" />
<section name="errorMail" requirePermission="false" type="Elmah.ErrorMailSectionHandler, Elmah" />
<section name="errorFilter" requirePermission="false" type="Elmah.ErrorFilterSectionHandler, Elmah" />
</sectionGroup>
</configSections>
connectionstringセクションを追加します
<connectionStrings>
<add name="elmah-express" connectionString="Data Source=[server name];Initial Catalog= [ELMAH_customlogging];User ID=testuser;Password=Welcome1;" />
</connectionStrings>
connectionstringセクションのすぐ下にelmahセクションを追加します
<elmah>
<security allowRemoteAccess="0" />
<errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="elmah-express" />
</elmah>
system.webのhttphandlersおよびhttpmodulesセクションにハンドラーとモジュールのエントリを追加します
<httpHandlers>
<add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/>
</httpHandlers>
<httpModules>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
</httpModules>
system.webserverの下のハンドラーとモジュールセクションにハンドラーとモジュールエントリを追加します
<modules runAllManagedModulesForAllRequests="true">
<remove name="ErrorLog"/>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah" preCondition="managedHandler" />
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah" preCondition="managedHandler" />
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah" preCondition="managedHandler" />
<add name="ErrorTweet" type="Elmah.ErrorTweetModule, Elmah" preCondition="managedHandler" />
</modules>
<handlers>
<add name="Elmah" path="elmah.axd" verb="POST,GET,HEAD" type="Elmah.ErrorLogPageFactory, Elmah" preCondition="integratedMode" />
</handlers>
SharePointでのelmahの実装については、以下のリンクを参照してください
http://sidteche.blogspot.in/2014/08/implement-elmah-custom-logging-in.html