There are few ways of custom logging in SharePoint 2013 –
- Use SPDiagnosticsService – You may write to the ULS via SPDiagnosticsService class.
- Utilize diagnostics.asmx web service – I have explained how to write log in Hive 15 log file in my previous blog (How to do logging in ULS from CSOM in c#?).
- Logging in SharePoint List – This is unconventional yet very powerful way of logging CSOM messages. Log files can be accessed directly from SharePoint site and access can be restricted.
In this blog, I will explain how to log error in SharePoint 2013 List.
Step 1 : Create Log List – First of all log list will be created in SharePoint site.
Step 2 : Create Folder In List – Folders will be created in List. The reason why folder is good way to proceed is folder will contain log entry on the basis of date.
Step 3 : Create Node – After that make a node in QuickLaunch so that you can access Log List directly.
I have uploaded a project that will add log in List. You will find project here.