We are creating a timer job that imports AD users into SharePoint list. I would liek to log this information somewhere so that at a later time I can check which users were pulled in and/why the program failed.

For this I have 3 options:-

  1. ULS Log.

  2. Write to C:\filename.txt

  3. Write to event viewer.

Please guide as to which should be the approach on production server. Or if there is a better approach other than this?

  • 1
    Event viewer is a good option as well(at least for critical errors), since you can make easy to access categories for your code specifically. Mar 21, 2014 at 9:58
  • 1
    I feel it is easier to code for logging into event viewer, and I dont feel it will cause burden on the system as logs are small files and text entries
    – variable
    Mar 21, 2014 at 10:06

1 Answer 1


You can order up your approaches as below,

  1. ULS

  2. Event Viewer

  3. Text file.

I suggest, ULS - Its the SharePoint native logging and it manages to remove the older files periodically, its better to keep all the SharePoint related logs in one place "ULS". Use SPDiagnosticsService.Local.WriteTrace method in your timer job to log into the ULS logs

If you find that reading logs from ULS is difficult then you can end up with your own text file for logging the errors/messages.

Have a look at the below link too,

TimerJobs and ULS

Five suggestions to implement a better logging in SharePoint

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.