This one isThese two are for those of you using a dedicated environment for testing their SharePoint solutions before going live. Of course these tips can be applied to production environments, too.
Getting Line Numbers in Your Stack Trace
As you probably know you will only get line numbers in your stack trace if Windows can access the respective .pdb file. But if you have GACed your assemblies there is no place arranged to store the corresponding .pdb files. This isn’t a problem if you are debugging with Visual Studio as it is smart enough to find it’s own .pdb files. But you don’t have Visual Studio on your testing machines…
While you can find outlandish attempts on the Net to GAC the .pdb files as well there’s a much simpler solution. Just add two entries to the registry under “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment”:
Set both values to the directory where you plan to store your .pdb files, for example “c:\PDB-Files” and restart IIS. After doing this for the machine you use to deploy your solutions add similar entries to your WFE’s registries. Of course they will point to the original directory, for example “\\188.8.131.525\c$\PDB-Files”.
When you deploy a solution simply copy the corresponding .pdb files to the dedicated folder. This will even work for release builds as they come with .pdb files, too. But due to optimizations the line numbers will not always be correct.
Monitoring Your SharePoint Logs
When testing a solution you usually want to monitor your SharePoint logs more closely. And of course you want to watch all your WFE’s logs in one place and have everything updated in real-time.
There are various tools for this. I choose ULS Viewer (see External References) for it’s features. Here’s how to set it up to monitor all your WFE’s logs:
- Create a mapped folder for each SharePoint log directory of your WFEs.
- In ULS Viewer: select File | Open From | ULS. The “Setup the ULS Runtime Feed” window appears.
- In the “Setup the ULS Runtime Feed” window:
- Select “Use directory location for real-time feeds”.
- Specify one of your log directories and click OK.
- Repeat the previous three steps for all your log directories.
I decided to show each log in it’s own tab because the Server column is always empty and one wouldn’t know from which WFE an entry originated if everything was in one tab. The drawback is that filtering gets more laborious but this is compensated by using stored filters. When writing this I found that you can even save and re-load workspaces–all your tabs with all their filters and configurations. So you’ll have to configure this only once–Yay!
Unfortunately I also found that having an empty filter value makes the program crash and others found problems with non-US date formats. But even with it’s bugs and strange UI the program has too many benefits to use something else:
- Monitor multiple logs, even from different machines
- Open multiple persisted log files in one tab
- Configurable notification system
- Smart Highlight: highlights all fields that have the same value as the one your mouse is hovering over
- And of course the features you’d expect anyway like filtering, sorting, and highlighting entries
Be aware that there is another program called ULS Viewer available on CodePlex. The one I’m using is Microsoft’s own tool and they kindly released it a while ago–although unsupported. Unfortunately this means there is no source code available and it doesn’t look like there will be an update anytime soon.