Pregunta

¿Alguien ha integrado ELMAH en su entorno de SharePoint?

Supongo que es posible ya que todo es ASP.net, pero me preguntaba si alguien lo había hecho y si hay un recorrido sobre cómo lograrlo.

¿Fue útil?

Solución

Utilizamos ELMAH en nuestro entorno MOSS 2007. Dado que ELMAH usa HttpHandlers y se configura a través de web.config, la activación fue muy fácil. Simplemente agregue las cosas de ELMAH a web.config para la aplicación que está ejecutando dentro de SharePoint.

Si desea que ELMAH informe errores a un nivel superior al de su aplicación personalizada, agréguelo a SharePoint web.config.

Otros consejos

Una cosa que ES importante al configurar ELMAH, o la mayoría de los HTTPModules en Sharepoint es que deben estar al comienzo de la sección httpModules. De lo contrario, SharePoint esencialmente se tragará la excepción y no se invocará la funcionalidad ELMAH

Works

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

No funciona

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

No tiene magia, solo conéctelo como lo haría en cualquier otro sitio ASP.NET.

Las siguientes son las entradas de configuración que deben agregarse en web.config de la aplicación web de SharePoint

Añadir bajo 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>

Agregar sección de cadena de conexiones

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

</connectionStrings>

Agregue la sección elmah justo debajo de la sección de la cadena de conexiones

<elmah>

  <security allowRemoteAccess="0" />

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

Agregue la entrada de controlador y módulo en la sección httphandlers y httpmodules en 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>

Agregar entrada de controlador y módulo en la sección de controladores y módulos en 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>

Consulte el siguiente enlace para la implementación de elmah en sharepoint

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top