Monday, July 16, 2012

Developer field notes: ASP.Net Diagnostics

I want to start mini series "Developer field notes", since I am trying to switch back to .Net development  world from Administrative world of SharePoint.
It's a interesting journey... for my ego. I knew almost everything to keep things running smoothly in SharePoint.
Now, I am at the point of zero. Know nothing, reading a lot, afraid to forget or misunderstand the basic of good style of .Net development.

I hope these notes will help me to remember what's fundamental and important....and maybe they will
be helpful for someone else out there.

Here are we go.

ASP.Net Diagnostics

Logging options:


 - ASP.Net Health Monitoring:
     Use a web.config to set this up:
A quick example:

 <system.web>
    <healthMonitoring enabled="true">
      <providers>
        <remove name="SqlWebEventProvider"/>


        <add connectionStringName="ApplicationServices" maxEventDetailsLength="1073741823"
                   buffer="false" bufferMode="Notification" name="SqlWebEventProvider"
                   type="System.Web.Management.SqlWebEventProvider,System.Web,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" />
      </providers>


      <rules>
        <add name="Everything" eventName="All Events" provider="SqlWebEventProvider"/>
        
      </rules>
      
    </healthMonitoring>


 - log4net 
http://logging.apache.org/log4net/

- elmah
http://code.google.com/p/elmah/

Scott Allen highlly recommended to check elmah library out. It has a lot built-in functionality which is helpful in ASP.Net app logging.

Pattern and practices Application Logging Block