When creating a Visual Studio workflow, webpart or other coded component for SharePoint, at times it makes sense to log events, notices, errors, etc to the 12 hive log. This is surprising easy to do, if you know the trick.
First, you need to include a reference to Microsoft.Office.Server. The image to the left shows the dll to add.
Then, in your class have the following: using Microsoft.Office.Server.Diagnostics;
Then, where ever you want to log add the following:
PortalLog.LogString(“Message that I want logged“);
And that is all there is to it. Now you can pass string values to the 12 hive logs.