Debug Logging In System Center Service Provider Foundation (SPF)


Symptoms


Microsoft System Center 2012 Service Pack 1 (SP1) System Provider Foundation (SC 2012 SP1 SPF) and Microsoft System Center 2012 R2 System Provider Foundation (SC 2012 R2 SPF) contain native debug logging capabilities to enable troubleshooting of SPF issues.  SPF incorporates Event Tracing for Windows (ETW) logging in order to produce verbose debug output.  This functionality is turned off by default in order to provide optimal service performance, but may be enabled when reproducing issues with SPF.  SPF logging may be enabled either through the Windows Event Viewer or through the command line by using the logman.exe utility.

More Information


Method 1: Command Line

This method has the advantage of being scriptable and also slightly less impactful to system performance.  Because each debugging session will produce a new log, this method is also generally easier to use for iterative troubleshooting.

To create an SPF ETL trace, use the following steps:

  1. Log on to your SPF server and open an elevated command prompt or PowerShell window by right-clicking on the shortcut and choosing Run as Administrator.
  2. Type the following commands to create the trace definition:

          For Microsoft System Center 2012 R2 System Provider Foundation (SC 2012 R2 SPF):

logman create trace spfdebugtrace -p Microsoft-ServiceProviderFoundation 0xc000000000000000 0x5
logman update spfdebugtrace -p Microsoft-Windows-PowerShell 0xf0010000000003ff 0x5
logman update spfdebugtrace -p ActivityEventSource 0x0 0xff               

         For Microsoft System Center 2012 Service Pack 1 (SP1) System Provider Foundation (SC 2012 SP1 SPF):

    logman create trace spfdebugtrace -p Microsoft-ServiceProviderFoundation-Core 0x8000000000000000 0x5
    logman update trace spfdebugtrace -p Microsoft-ServiceProviderFoundation-VMM 0x8000000000000000 0x5
    logman update spfdebugtrace -p Microsoft-Windows-PowerShell 0xf0010000000003ff 0x5
     
  1. Type logman start spfdebugtrace to start the trace.
  2. Reproduce the issue you are investigating.
  3. Stop the trace by typing logman stop spfdebugtrace
  4. Navigate to the trace location (C:\PerfLogs\Admin by default, see below), and convert the trace to a readable format by typing the command netsh trace convert spfdebugtrace_000001.etl.  Note that the exact file name of the ETL file may be different if you have taken multiple traces.  Type logman query spfdebugtrace and investigate the Output location value to see the name of the latest ETL file.

Tips:

  • You can change the location of the log file by using the command logman update trace spfdebugtrace -o <location>.  For example, logman update trace spfdebugtrace c:\temp.
  • If you cannot log on to the SPF server directly, but still have network connectivity, you can create the trace remotely by appending -s <computername> to the logman commands above.  For example: logman create trace spfdebugtrace -p Microsoft-ServiceProviderFoundation-Core 0x8000000000000000 0x5 -s spfserver01.
  • ETL log files can grow large very quickly.  Attempt to reproduce your issue and stop the trace as soon as the issue reproduces.
  • It may be helpful to simultaneously gather VMM debug logs for some issues.  See http://support.microsoft.com/kb/2801185/en-US for details.

Method 2:  Event Viewer 

An alternate method to view SPF debug information is to enable the trace channel through Event Viewer.  This method is less error-prone, but may be more difficult to view data if a large number of entries are logged.  The information logged is identical.

 To enable SPF debug logging in Event Viewer, use the following steps:

  1. Open Event Viewer and select View, then select Show Analytic and Debug Logs if it is not already selected.
  2. Navigate to Applications and Services Logs\Microsoft\ServiceProviderFoundation\Core
  3. Right-click The Analytic channel for SPF core and select Enable log.  Answer OK when prompted to enable the log.
  4. Repeat step 3 for Applications and Services Logs\Microsoft\ServiceProviderFoundation\VMM\SPF VMM Analytic log
  5. Reproduce your issue
  6. Right-click on each log and choose Disable log.  Captured events will appear in the right-hand pane.

Tip:  You can export the logs for easier viewing by choosing Actions\Save All Events As... and changing the Save as type to Text (Tab delimited)(*.txt).