While working as a SharePoint developer every one of us must go to the SharePoint log files to determine the exact nature and cause of an error. SharePoint logs provide us vital information to resolve the issue. SharePoint provides us a correlation id to get the details about the issue, but it is difficult sometimes to go and check the log files and manually find the error in the log and get the cause, since the log files are huge sometimes.
To resolve this we have some PowerShell cmdlets that we can use to search in log files. Some of them are Get-SPLogEvent and Merge-SPLogFile. They are explained below.
- Get-SPLogEvent
- get-splogevent | ?{$_.Message -like "*Monitored*" -and $_.Correlation -eq "2713db9c-f21e-e0bc-3393-95ddcbf60bd0"} | select Area, Category, Level, EventID, Message | Format-List > C:\Log1.log
- get-splogevent | ?{$_.Correlation -eq "2713db9c-f21e-e0bc-3393-95ddcbf60bd0"} | select Area, Category, Level, EventID, Message | Format-List > C:\Log2.log
You can use the preceding commands directly also on PowerShell to get the details directly instead of creating a file out of it, like:
- get-splogevent | ?{$_.Message -like "*user*" -and $_.Correlation -eq "2713db9c-f21e-e0bc-3393-95ddcbf60bd0" -and $_.Level -eq "Medium" -and $_.Category -eq "App Deployment"} | select Area, Category, Level, EventID, Message
- get-splogevent -StartTime "12/11/2014 10:00" -EndTime "12/12/2014 18:00"
- bove command will search the logs with specified date range and display on PowerShell window.
- Merge-SPLogFile
- Merge-SPLogFile -Path "C:\Log1.log" -Overwrite -Message "*Monitored*" – Correlation "2713db9c-f21e-e0bc-3393-95ddcbf60bd0"
- Merge-SPLogFile -Path "C:\Log2.log" -Overwrite -Message "*Monitored*" – Correlation "2713db9c-f21e-e0bc-3393-95ddcbf60bd0"
- Merge-SPLogFile -Path "C:\Log3.log" -Overwrite -StartTime "12/11/2014 10:00" - EndTime "12/12/2014 18:00"
I hope this will reduce some of the debugging efforts.

Mukesh KumarPosted Nov 29, 2015, 3:20 AM
Nice One
Karthik Muthu KaruppanPosted Mar 30, 2015, 11:10 AM
simple and great
Gowtham RajamanickamPosted Mar 30, 2015, 10:10 AM
good show..
Vijay SPosted Mar 30, 2015, 5:55 AM
Good show