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
Open the Registry editor (regedit.exe)
Navigate to your service’s key:
System\CurrentControlSet\Services\WAS
In the “Environment” multi-string value, add the following parameters in separate lines:
SL_LogLevel=6
SL_LogDir=C:\SeaLights\Logs
Perform the previous step on
System\CurrentControlSet\Services\W3SVC
Restart IIS
iisreset /restart
Collecting Profiler logs from Windows Services
Open the Registry editor (regedit.exe)
Navigate to your service’s key:
System\CurrentControlSet\Services{YourService}
In the “Environment” multi-string value, add the following parameters in separate lines:
SL_LogLevel=6
SL_LogDir=C:\SeaLights\Logs
Collecting Profiler logs from Windows Processes
Define the following Environment Variables in the environment from which your process is started:
SL_LogLevel=6
SL_LogDir=C:\SeaLights\Logs
This can be achieved by running the following commands in their respective shells:
set SL_LogLevel=6
set SL_LogDir=C:\SeaLights\Logs
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.
Collecting Profiler logs from VSTS/Azure DevOps Test Stages
In the “SeaLights Start Test Execution” step:
Set the “Profiler log level” to Debug
Run the build, including the test stage in question
After the build finished, review the logging destination:
Select the “SeaLights Start Test Execution” log
Towards the end of the logging output, there should be a string “Logs will be saved to”
The logging files will be inside the folder denoted above