# Collecting Profiler Logs

When debugging issues related to coverage on .NET, we sometimes need to retrieve Profiler logs.

The Profiler is a C++ component in charge of instrumenting tests during runtime, as well as the applications under test.

The following document details the necessary steps to collect these logs.

***

### Collecting Profiler logs from IIS <a href="#collecting-profiler-logs-from-iis" id="collecting-profiler-logs-from-iis"></a>

1. Open the Registry editor (regedit.exe)
2. Navigate to your service’s key: `System\CurrentControlSet\Services\WAS`
3. In the “Environment” multi-string value, add the following parameters in separate lines:
   1. `SL_LogLevel=6`
   2. `SL_LogDir=C:\SeaLights\Logs`
4. Perform the previous step on `System\CurrentControlSet\Services\W3SVC`
5. Restart IIS `iisreset /restart`

### Collecting Profiler logs from Windows Services <a href="#collecting-profiler-logs-from-windows-services" id="collecting-profiler-logs-from-windows-services"></a>

1. Open the Registry editor (regedit.exe)
2. Navigate to your service’s key: `System\CurrentControlSet\Services{YourService}`
3. In the “Environment” multi-string value, add the following parameters in separate lines:
   1. `SL_LogLevel=6`
   2. `SL_LogDir=C:\SeaLights\Logs`

### Collecting Profiler logs from Windows Processes <a href="#collecting-profiler-logs-from-windows-processes" id="collecting-profiler-logs-from-windows-processes"></a>

1. Define the following Environment Variables in the environment from which your process is started:
   1. `SL_LogLevel=6`
   2. `SL_LogDir=C:\SeaLights\Logs`
2. This can be achieved by running the following commands in their respective shells:
   1. `set SL_LogLevel=6`
   2. `set SL_LogDir=C:\SeaLights\Logs`

{% hint style="info" %}
Note: if your process starts from within a .bat file, a PowerShell script etc, the above environment variables need to be declared in those shells, or as Global environment variables.
{% endhint %}

### Collecting Profiler logs from VSTS/Azure DevOps Test Stages <a href="#collecting-profiler-logs-from-vsts-azure-devops-test-stages" id="collecting-profiler-logs-from-vsts-azure-devops-test-stages"></a>

1. In the “SeaLights Start Test Execution” step:
   1. Set the “Profiler log level” to Debug

      <figure><img src="https://4057366433-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAjqTCMRYvHhDgsdPLUnc%2Fuploads%2FInV0c4SALtbizNMwAOPA%2Fimage-20210303-075757.png?alt=media&#x26;token=ff134a6b-c8c3-44b2-a201-ac8e6247f420" alt=""><figcaption></figcaption></figure>
2. Run the build, including the test stage in question
3. After the build finished, review the logging destination:
   1. Select the “SeaLights Start Test Execution” log
   2. Towards the end of the logging output, there should be a string “Logs will be saved to”
   3. The logging files will be inside the folder denoted above
