Google Groups Home
Help | Sign in
sharepoint and elmah
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
ajam  
View profile
 More options Apr 10, 12:02 pm
From: ajam <Edward.Tew...@gmail.com>
Date: Thu, 10 Apr 2008 09:02:28 -0700 (PDT)
Local: Thurs, Apr 10 2008 12:02 pm
Subject: sharepoint and elmah
Hello,

I have spent most of the day trying to get elmah working with
sharepoint 2007 without luck.  The handler has been successfully set
up so that I can reach the elmah.axd page.

I have followed all the instructions but errors in sharepoint are not
getting logged to elmah.  It seems to me that sharepoint is not
passing the error to the httpapplication error event:(

-----------

Good news - literally as I was typing this post, I decided to try
changing the order of the httpmodule declaration in web.config.  I put
the elmah module before the others and voila!!!  - it works.

I'll leave this post just in case it helps someone.

Thanks for a great product by the way Atif !!!!   I'm surprised there
isn't more discussion of it in the context of sharepoint.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Atif Aziz  
View profile
 More options Apr 10, 12:09 pm
From: Atif Aziz <Atif.A...@skybow.com>
Date: Thu, 10 Apr 2008 18:09:52 +0200
Local: Thurs, Apr 10 2008 12:09 pm
Subject: RE: [ELMAH] sharepoint and elmah
Thanks for sharing this, Edward. Dare I suggest...Why not put your findings into a more structured wiki article that we can then post over at http://code.google.com/p/elmah/w/list?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ajam  
View profile
 More options Apr 11, 3:06 am
From: ajam <Edward.Tew...@gmail.com>
Date: Fri, 11 Apr 2008 00:06:14 -0700 (PDT)
Local: Fri, Apr 11 2008 3:06 am
Subject: Re: sharepoint and elmah
Wow, you are quick at relying to this forum.

You are right.  The least I can do to say thank you is to share my
experience.  I cannot promise when I'll be able to do it, but over the
next few days as I learn more about Sharepoint and elmah, I will try
to put what I have learnt together to share.

Regards,

Ed

On Apr 10, 6:09 pm, Atif Aziz <Atif.A...@skybow.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Atif Aziz  
View profile
 More options Apr 11, 3:12 am
From: Atif Aziz <Atif.A...@skybow.com>
Date: Fri, 11 Apr 2008 09:12:02 +0200
Local: Fri, Apr 11 2008 3:12 am
Subject: RE: [ELMAH] Re: sharepoint and elmah

> over the
> next few days as I learn more about Sharepoint and elmah, I will try
> to put what I have learnt together to share.

Awesome and looking forward. I get asked about SPS and ELMAH occasionally but since I have very little experience with SPS, I usually shy away from the questions. I'd be great if you could share your in-field experience from the trenches. :) It might be the springboard for someone else to jump in as well with their wisdom. By the way, don't let the formatting get in your way. Even if you write up something in HTML or Word, I can quickly convert it to wiki and post it on the ELMAH project site.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ajam  
View profile
 More options May 30, 4:06 am
From: ajam <Edward.Tew...@gmail.com>
Date: Fri, 30 May 2008 01:06:43 -0700 (PDT)
Local: Fri, May 30 2008 4:06 am
Subject: Re: sharepoint and elmah
I'm really sorry it has taken me so long to post my feedback - and it
isn't even that special.  I've just been very busy.  Anyway, here
goes:

Elmah works pretty much out of the box with SharePoint 2007.  The main
thing that took me some time to work out was that the httpmodules
section in web.config had to go in before all the other modules - the
subject of my original post here.

The other thing I did was to place the Elmah dll in the GAC (which
requires it to be signed).  This means that references to Elmah in the
web.config file need to use the fully qualified name.  In my case, the
entry for the httpmodule was:

 <add name="ElmahErrorLog" type="Elmah.ErrorLogModule, Elmah,
Version=1.0.9414.0, Culture=neutral, PublicKeyToken=512382219eb3b98f" /


Without doing this, I encountered issues with permissions.  I think
there are other ways of solving this - by modifying the trust level
used by SharePoint for example - I found using the GAC to be the best
solution for me though.

What I found really usefull was that all the errors from each of my
front end web servers were logged together.  I was then able to
install the Elmah handler for viewing the errors on  another webserver
which is part of the farm but not accesible to the public (it hosts
the central administrative site for sharepoint).  From this "safe" web
server, I was able to see the error logs for the whole farm.

Another thing that I've been quite pleased with - and this is
SharePoint specific - is that I was able to make a small change in the
ELMAH code which allowed me to set a custom error page for my web
application.  This may seem insignificant - everyone knows you can set
a custom error page in the web.config.  Well, try doing that with
SharePoint.  Microsoft for some reason has built into the logic of
sharepoint, a reference to one single error page that all Sharepoint
applications on a given web server share.  This is a real pain but
with the following lines added to the "OnError" method in
ErrorLogModule.cs in the Elmah source code, this was solved:

        HttpContext.Current.Server.ClearError();
            HttpContext.Current.Response.Clear();
          HttpContext.Current.Response.Redirect("/_layouts/custom/
error_portal.html");

Maybe there is a smarter solution but this worked for me and was very
easy to implement.

There is a similar issue in sharepoint with unauthorised access page
in Sharepoint.  There is just one that is shared by all the
applications.  It would be interesting if there is some way in which
Elmah could help in intercepting an unauthorised access and
redirecting to a custom error page.

On Apr 11, 9:12 am, Atif Aziz <Atif.A...@skybow.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ajam  
View profile
 More options May 30, 4:21 am
From: ajam <Edward.Tew...@gmail.com>
Date: Fri, 30 May 2008 01:21:43 -0700 (PDT)
Local: Fri, May 30 2008 4:21 am
Subject: Re: sharepoint and elmah
just a small addition.  I had quite a few servers with a few
applications which I wanted to add elmah to.  I wrote a pretty basic
powershell script to add the entries to web.config.  Not really an
example of a great powershell script but it did the job for me and
saved me quite some hassle.  It only adds the minimum entries for
logging to the sql provider but after reading the elmah documentation,
it should be easy enough to figure out what its doing and how to adapt
it for your situation:

function AddToWebConfig{
param(
                $filepath
        )

[xml]$cfg = Get-Content $filepath

$htmnode = $cfg.SelectNodes("configuration/system.web/
httpModules").Item(0)
$newhtm = $cfg.CreateElement("add")
$newhtm.SetAttribute("name", "ElmahErrorLog")
$newhtm.SetAttribute("type", "Elmah.ErrorLogModule, Elmah,
Version=1.0.9414.0, Culture=neutral, PublicKeyToken=512382219eb3b98f")
$cfg.configuration."system.web".httpModules.insertbefore($newhtm,
$htmnode.get_FirstChild().get_NextSibling())

$refnode = $cfg.SelectNodes("configuration").Item(0)
$newnode = $cfg.CreateElement("elmah")
$newnode.Set_InnerXml("<errorLog type=""Elmah.SqlErrorLog,  Elmah,
Version=1.0.9414.0, Culture=neutral,
PublicKeyToken=512382219eb3b98f""
connectionStringName=""myDataConnectionString""/>")
$cfg.configuration.insertbefore($newnode,
$refnode.get_FirstChild().get_NextSibling())

$newSG = $cfg.CreateElement("sectionGroup")
$newSG.SetAttribute("name", "elmah")
$elstr =
@"
      <section name="errorLog" requirePermission="false"
type="Elmah.ErrorLogSectionHandler,  Elmah, Version=1.0.9414.0,
Culture=neutral,    PublicKeyToken=512382219eb3b98f" />
"@
$newSG.Set_InnerXml($elstr)
$cfg.configuration.configSections.appendchild($newSG)

$cfg.Save($filepath)

}

$fpath = "C:\Inetpub\wwwroot\wss\VirtualDirectories\hbos-efs-
vertrieb80\web.config"

AddToWebConfig  $fpath


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google