The circle of life – ** .Net – Training – MOSS **

  • Past Post

  • Vistor Locations

  • Advertisements

Log errors to SharePoint Log file

Posted by Clayton James on October 29, 2007


I came across this nice code snippet to log exceptions to the default SharePoint log file. (Putting it here for the memory bank).


catch(Exception myException)



Occurred: {0} || {1}”, myException.Message, myException.StackTrace);



5 Responses to “Log errors to SharePoint Log file”

  1. Sean Fox said

    Did somebody not mention the need for wiring a reference to Microsoft.Office.Server? Adding this reference in makes MOSS find my workflow deployment rather distasteful and will thereby reject it?

  2. Halesh said

    Hay Sean,

    It’s working fine 🙂

  3. Sean Fox said

    Ope, wait!!! I spoke too soon man. Great method, however. Another good one is to just use the Sharepoint Audit log, which you can run reports against.


  4. Dave said

    This works great if and only if you’re using MOSS. If you’re just using WSS, this absolutely will not work, as you will not have the Microsoft.Office assembly.

  5. […] (briefly documented in Clayton James’ post Log errors to SharePoint Log file) but that is not available in WSS. There are some examples listed including Eli Robillard’s […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: