New to Telerik JustMock? Download free 30-day trial

Profiler Log And Trace

In this article you will get familiar with Telerik JustMock Profiler built-in log and trace capabilities. Elevated mocking is strongly relies on profiler and sometimes it might be blocked by unexpected behavior which is hard to be troubleshooted. Here comes the profiler trace, it is really useful for finding where the problem comes from.

Enabling the Profiler Log And Trace

The log and trace functionality is controlled entirely via environment using dedicated variable JUSTMOCK_LOG_LEVEL. Possible values are: TRACE, DEBUG, INFO, WARN, ERROR, CRITICAL and OFF. Values from TRACE to CRITICAL enable tracing with different verbosity level in descending order, while OFF completely disables it. All traces are redirected to system debug output.

Inspecting the Profiler traces

System debug could be visualized without debugger by using DebugView. The typical output from the tool look like as following:

Debug View Traces

Keep in mind that the tool captures the output from whole system, so for convenience the traces could be filtered by the keyword JustMockProfiler.

Debug View Filter Trace

Tip!

The traces inside DebugView window can be redirected to a file for further offline analysis.

Let's follow up an example, showing how the profiler trace can be enabled while executing test container from the command prompt step by step:

  1. Setting up profiler trace level using environment variable

    set JUSTMOCK_LOG_LEVEL=DEBUG
    
  2. Launch DebugView and make sure that 'Capture Win32' and 'Capture Events' options are enabled

Debug View Filter Trace

  1. Setup filter in DebugView with keyword JustMockProfiler

  2. Launch test execution in elevated (advanced) mode. The easiest way to achieve that is to use Telerik.JustMock.Console

"C:\Program Files (x86)\Progress\Telerik JustMock\Libraries\Telerik.JustMock.Console.exe" --profiler-path-32="C:\Program Files (x86)\Progress\Telerik JustMock\Libraries\CodeWeaver\32\Telerik.CodeWeaver.Profiler.dll" --command="vstest.console.exe" --command-args="bin\Debug\net45\UnitTestProject.dll"
  1. Profiler traces will start to appear inside DebugView window
In this article
Not finding the help you need? Improve this article