2009-05-06 10 views

risposta

5

Utilizziamo ELMAH nel nostro ambiente MOSS 2007. Dato che ELMAH utilizza HttpHandlers ed è configurato tramite web.config, attivarlo è stato un gioco da ragazzi. Basta aggiungere le cose ELMAH al web.config per l'applicazione che stai eseguendo all'interno di SharePoint.

Se si desidera che ELMAH segnali errori a un livello superiore rispetto all'applicazione personalizzata, quindi aggiungerlo al web.config di SharePoint.

+0

roba eccellente! Grazie. Quindi se non prendi tu stesso un'eccezione nel codice, si muoverà sulla pipeline fino a che ELMAH non lo catturerà e lo registrerà? – Rob

+0

Sì, è esattamente quello che succede. Puoi anche registrare le eccezioni gestite in ELMAH. –

+1

Dove hai distribuito la tua dll? Mi piacerebbe distribuire al GAC per coprire tutti i nostri siti web. – Rob

0

Non c'è magia, basta collegarlo come si farebbe su qualsiasi altro sito ASP.NET.

9

Una cosa che è importante quando si imposta ELMAH o la maggior parte dei moduli HTTP in SharePoint è che devono essere all'inizio della sezione httpModules. In caso contrario, SharePoint sarà essenzialmente ingoiare l'eccezione e la funzionalità ELMAH non sarà invocato

Opere

<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.... 

Non funziona

<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"/> 
+0

ottimo consiglio, grazie! – Rob

0

seguito sono le voci di configurazione che devono aggiunto web.config dell'applicazione web di SharePoint

Aggiungi sotto 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> 

Aggiungere connectionString sezione

<connectionStrings> 
<add name="elmah-express" connectionString="Data Source=[server name];Initial Catalog= [ELMAH_customlogging];User ID=testuser;Password=Welcome1;" /> 

</connectionStrings> 

Aggiungi ELMAH sezione appena sotto la sezione connectionstring

<elmah> 

    <security allowRemoteAccess="0" /> 

    <errorLog type="Elmah.SqlErrorLog, Elmah" connectionStringName="elmah-express" /> 
</elmah> 

Aggiungi conduttore e voce del modulo in httpHandlers e httpModules sezione in system.web

<httpHandlers> 

     <add verb="POST,GET,HEAD" path="elmah.axd" type="Elmah.ErrorLogPageFactory, Elmah"/> 

    </httpHandlers> 

    <httpModules> 

     <add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/> 
    </httpModules> 

Aggiungere conduttore e voce del modulo nei gestori e moduli di sezione in 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> 

prega di fare riferimento al di sotto di collegamento per l'attuazione ELMAH in SharePoint

http://sidteche.blogspot.in/2014/08/implement-elmah-custom-logging-in.html

Problemi correlati