Have you ever had the need to debug StoreFront? I have on a couple of occasions and it wasn’t the easiest debugging exercise I’d ever undertaken unfortunately. Changing the logging level is easy enough with the PowerShell cmdlet Set-DSTraceLevel. For example, run the following on a StoreFront server to enable verbose logging (see https://support.citrix.com/article/CTX139592):
Add-PSSnapin Citrix.DeliveryServices.Framework.Commands Set-DSTraceLevel –All –TraceLevel Verbose
Which will restart the Citrix services, having updated web.config files, and various log files will be created in “C:\Program Files\Citrix\Receiver StoreFront\Admin\trace”. It will also cause debug statements to be produced which can be picked up with tools like SysInternals dbgview.
The problem, in my experience, is that reading the log files, of which there are many, can be a bit of a chore. The log files are almost XML format but they are not fully compliant as they don’t have a top level node, since presumably adding this would have a performance hit. Even if you can get them into XML, working with them in XML isn’t particularly easy although that may depend on what XML tool you use (I would typically use Internet Explorer since that’s all I can rely on being on customer machines where I don’t want to start installing third party software).
Fortunately, PowerShell comes to our rescue (yet again) since it’s very easy in scripts to make this almost XML be properly formed so that this can then be quickly parsed and each log record output to a csv file or an on-screen grid view where filtering and/or searching can then take place.
The script is available here and can extract logs from multiple StoreFront servers, by accessing the logs via their C$ share, and splicing them together based on the time of each event. You can either specify a starting and ending date/time range via –start and –end respectively, specify –sinceBoot to include all entries since the last boot of each server or use –last with a number and a specifier such as ‘d’ for days, ‘m’ for minutes and ‘s’ for seconds so “-last 8h” means “in the last eight hours”. For example run the following to see all errors in the last two hours on the two specified StoreFront servers and display on-screen in a filterable grid view:
& '.\parse storefront log files.ps1' -computers storefront01,storefront02 -last 2h -subtypes error
If you have verbose logging enabled but only want to show warning and error entries then specify “-subtypes error,warning” since the default is to include all entries, including verbose ones.
Clicking “OK” at the bottom right of the grid view will copy any selected log lines into the clipboard, e.g. for web searches or logging with Citrix.
Specifying the -Verbose option gives information on what logs are being parsed, from which servers and for what time ranges.
Finally, don’t forget to change the StoreFront logging level back to something like “Error” rather than leaving it at “Verbose” as that is unlikely to help performance!