New-SPLogFile PowerShell Cmdlet in SharePoint Troubleshooting

The New-SPLogFile cmdlet in SharePoint 2013 creates a new ULS trace log file on execution. In other words, once you execute the New-SPLogFile command, it ends the current log file and creates a new log file. All subsequent errors will be placed in the new log file, which intern greatly helps to isolate all new errors.

It’s a good idea to start a new log file when you troubleshoot any issues in SharePoint, as identifying current issues from existing logs could be cumbersome, while existing log files can become large and difficult to scan through. Here is how you can utilize the New-SPLogFile cmdlet.

  1. Go to SharePoint PowerShell Management Shell.
  2. Type: New-SPLogFile and hit enter. It doesn’t have any parameters.
  3. Now, your new trace log file will be created. Once the new log file is created, you can trigger the event that is causing issues.
    New-SPLogFile PowerShell command
  4. Get your trace log location from the diagnostic log path. Go to: Central Administration >> Monitoring >> Configure diagnostic logging >> Trace Log Path
    powershell new-splogfile sharepoint
  5. Go to the trace log location, sort using created date, and there you’ll find your new log file created! Open it to start your troubleshooting.

Technet reference on New-SPLogFile

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

Leave a Reply

Your email address will not be published. Required fields are marked *