Friday, September 3, 2010

Simple Concept:How to enable fusion log

Why I need fusion log? And how to enable fusion log? 


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=, 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