Technology Toolbox

Your technology Sherpa for the Microsoft platform

Jeremy Jameson - Founder and Principal



Configuring Logging in SharePoint Application Pages

This post originally appeared on my MSDN blog:

Since I no longer work for Microsoft, I have copied it here in case that blog ever goes away.

In my previous post I showed how my simple, but highly effective approach to logging can be used with ASP.NET Web applications -- including Microsoft Office SharePoint Server (MOSS) and Windows SharePoint Services (WSS).

Note that SharePoint application (i.e. _layouts) pages are served from a different virtual directory than content pages within the Web application. Consequently, in order to view log messages when, for example, activating a feature (e.g. using http://fabrikam/en-US/Products/_layouts/ManageFeatures.aspx) the System.Web.WebPageTraceListener must be specified in the Web.config file within the following folder:

%ProgramFiles%\Common Files\Microsoft Shared\Web Server Extensions\12\template\layouts

Also be sure to enable tracing using the <trace> element within <system.web> in that Web.config file, as shown in my previous post.

Now you can easily view log messages from a feature receiver that uses the custom Logger class regardless of whether the feature is "activated" via Site Settings, through stsadm.exe, or from within Visual Studio via a unit test.


  1. # Links (6/22/2009) « Steve Pietrek – Everything SharePoint and Office

    June 22, 2009 9:07 AM

Add Comment

Optional, but recommended (especially if you have a Gravatar). Note that your email address will not appear with your comment.
If URL is specified, it will be included as a link with your name.

To prevent spam from being submitted, please select the following fruit: Cherries

Please add 2 and 3 and type the answer here: