Posts for logging


  • SharePoint 2010/2013 Custom ULS

    SharePoint has an awesome logging system. Anything that happens in SharePoint can be found in the ULS, and it's highly configurable as to what type of detail you see. In MVC applications, there are 100 different logging frameworks and destinations, but while you are in SharePoint, your code should log to the same place everything else does. A simple way to log would be to make a call to SPTrace, but you lose the ability to name your "product" and get full customization of the logging levels. A better option is extending the SPDiagnosticsServiceBase class with your own custom logging class. It is much easier to use in larger projects, and allows you to make full use of the configuration options in central admin. Here is the class I use, scroll below the class for some notes: