Stock photo from pixabay.com

Using PowerShell to set ULS logging level to “extra verbose” to catch all the events in the logs

This blog post describes how set the SharePoint’s ULS level to “Extra Verbose” (VerboseEx) using PowerShell. This is not possible using the browser UI, so some POSH magic is required! Luckily, it’s quite straightforward, but to avoid filling your hard drive(s) with huge log files, you should reset the level when you’re done debugging!

Description of the solution

By default, ULS logging is somewhat non-detailed. This means that a lot of data that could be used to debug issues is omitted. The UI cannot be used to set this level of logging to “Extra Verbose” – it is limited to verbose. In case you really, REALLY need to get all the data logged to ULS, you can use PowerShell to enable VerboseEx -level tracing, using the following command:

Set-SPLogLevel -TraceSeverity VerboseEx

Beware, though: this will generate a lot of data, and it’s likely you won’t be able to do anything with the log files using notepad++ or similar tool, as a single file can be hundreds of megabytes, and handling that might get a little tricky.

How to reset the Logging verbosity from “extra verbose” to medium?

So now you have the logs you needed – that’s great! SharePoint will keep logging everything, though, and will eventually fill your hard drives with extra verbose data, that’s really not needed for your normal operations. It’s a good idea to undo the setting you just did!

Luckily enough, you can always reset this setting to default (medium-level tracing) by running the following command:

Clear-SPLogLevel

Other logging levels available

If you want to use any other level instead, you can just run the “Set-SPLogLevel -TraceSeverity” with any of these values:

ULS Level Name

Level ID

Description

Unexpected

10

Similar to an Assert (an assumption in code that a condition is true at a particular point), this message indicates that a logic check failed that is atypical, or the message returns an unexpected error code. These generally represent code bugs that should be investigated and fixed.

Monitorable

15

Traces that indicate a problem, but do not need immediate investigation. The intent is to collect data and analyze it over time, looking for problem trends.

High

20

General functional detail, the high priority events that happen in the environment. Examples include global configuration modifications, service start and stop, timer jobs completed, and so on.

Medium

50

Useful to help support or test teams debug customer or environmental issues. These likely include messages indicating that individual features have succeeded or failed, such as creating a new list, modifying a page, and so on.

Verbose

100

Useful primarily to help developers debug low-level code failures. Not generally useful to anyone who does not have access to source code or symbols. Most event tracing that does not need to be enabled all the time should be set at the Verbose level.

VerboseEx

200

Useful for traces that are likely to be high volume, especially information that is not needed for all debugging scenarios. Examples of situations where you should use the VerboseEx setting are method entry and exit events, tracing in loops, or to relay information that is not useful to developers outside your team.

Useful resources for further reading

More info about the trace levels:

The following two tabs change content below.

Antti K. Koskela

Solutions Architect / Escalations Engineer at Koskila / Norppandalotti Software / Valo Solutions
Antti Koskela is a proud digital native nomadic millenial full stack developer (is that enough funny buzzwords? That's definitely enough funny buzzwords!), who works as a Solutions Architect for Valo Intranet, the product that will make you fall in love with your intranet. Working with the global partner network, he's responsible for the success of Valo deployments happening all around the world. He's been a developer from 2004 (starting with PHP and Java), and he's been bending and twisting SharePoint into different shapes since MOSS. Nowadays he's not only working on SharePoint, but also on .NET projects, Azure, Office 365 and a lot of other stuff. This is his personal professional (e.g. professional, but definitely personal) blog.

Let me know your thoughts!