Sharing the experience search

Search sharing-the-experience.blogspot.com
Showing posts with label Logging. Show all posts
Showing posts with label Logging. Show all posts

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





Friday, September 3, 2010

Simple Concept:How to enable fusion log



[Question]:
Why I need fusion log? And how to enable fusion log? 


[Answer]:


Ever experienced the error with loading dll?


Recently did something wrong and found a lots errors in the system event log similar to this:
SafeControl load exception:Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c Exception:


Fusion log comes in very handy when you want to understand or debug binding behaviors. 


In order to enable it:
1. Easy going method:
Download SDK;
Install it;
Run the sdk command prompt;
Input Fuslogvw.exe




2. Manually:



regedit.exe - HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion
set the registry key to enable fusion logging. HKLM/Software/Microsoft/Fusion/EnableLog DWORD 1




 By default the log files go into the Temporary Internet Files folder of the current user’s profile. 


Optionally you can set you custom path for log:  HKLM/Software/Microsoft/Fusion/LogPath String [your disk: you location]


Be careful! If you setup your own custom location - you are responsible to clear it out 


After the setting the keys - IISreset and load any pages, it will trigger the logging.
To analyze you can search in the fusion log folder by name of dll with which you are experiencing the issue. Or you can find the folder of your process  that triggered the loading of this dll. Every ddl has own file with history of loading.


To make reading more convenient you can use the Assembly Binding Log Viewer (Fuslogvw.exe) 
It's included in .NET Framework 2.0 Software Development Kit (SDK)


Additional information on register keys for Fusions log : Fusion Log Viewer