Geeks With Blogs

Tim Murphy

Tim is a Solutions Architect for PSC Group, LLC. He has been an IT consultant since 1999 specializing in Microsoft technologies. Along with running the Chicago Information Technology Architects Group and speaking on Microsoft and architecture topics he was also contributing author on "The Definitive Guide to the Microsoft Enterprise Library".

I review for the O'Reilly Blogger Review Program

Technorati Profile

Tim Murphy's .NET Software Architecture Blog Adventures in Architecting and Developing .NET

Over the last few months we have been developing custom SharePoint timer jobs.  Since the jobs run under a Windows Service it makes it difficult to debug them.  The saving grace we found is called ULS.  It gives you a logging location that is consistent with the native timer jobs and an API which resembles most other logging frameworks.

In order write events you first need to include the Microsoft.SharePoint.Administration assembly.  Then it is simply a matter of getting an instance of a SPDiagnosticsService and calling the WriteTrace method.  There isn’t much more to it than that.

Once you have your code decorated with WriteEvent calls and deployed you can then use the ULS viewer to monitor the output.  This captures messages as they happen when connected to the ULS source.  Since so many actions write to this repository you will need to use the viewer’s filter feature to keep your sanity.  The first thing you will want to do is limit the Process to OWSTIMER.  After that filter for your for any identifiers you may have put in your messages.

Hopefully this makes the development of timer jobs easier for everyone.

Posted on Wednesday, May 11, 2011 3:07 PM Development , SharePoint | Back to top

Comments on this post: Custom SharePoint Timer and ULS

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Tim Murphy | Powered by: | Join free