Codementor Events

ReflectInsight – Live Viewer

Published Aug 24, 2018

Learn about the Live Viewer tool of ReflectInsight in this guest post by Matt R. Cole, the author of Hands-On Machine Learning with C#.

Every developer needs to have a good logging tool. Unfortunately, what often happens is that developers keep up with the latest and greatest of everything, but not logging. In a way this is good—the best logging framework is the one you don't even know is working. However, if you have not used ReflectInsight from ReflectSoftware before, you are missing out on so much. It is so incredibly important to have the right logging tool, especially in machine learning, and nothing comes close to the rich, robust logging provided by this tool!
You absolutely need to know what's going on inside your algorithm, and ReflectSoftware has the richest logging capabilities around. And when you move into deep learning, you are going to be very happy that you can see what is going on under the cover.

With an algorithm running for possibly days, the insights you receive from the right kind of logging are invaluable:

1.png

ReflectInsight comprises of a Software Development Kit (SDK), a router, a Log Viewer, and a Live Viewer. This article will cover Live Viewer:

Live Viewer

The Live Viewer is what you will use most of the time to view your real-time logging. The capabilities of the Live Viewer are extensive to say the least. Briefly, the high-performance logging allows you to monitor instrumented applications in real time by displaying log messages in the Live Viewer. You can log incredibly rich details, such as exceptions, objects, datasets, images, process and thread information, and well-formatted XML.

You can also easily navigate and trace through your applications to find the information you need. The MessageDetails panel displays the extended details of the selected message. The details could be as simple as the message itself, or they can be complex data, such as objects, datasets, binary blobs, images, process and thread information, and the contents of a collection. Syntax highlighting is available for select message types such as SQL, XML, and HTML-related messages, as well as full Unicode support, which aids in the viewing of these types of messages.

Message navigation

ReflectInsight supports many ways of navigatng through your logged messages. You can navigate using one of the following methods:
• Find a matching Enter/Exit method block
• Jump to a parent Enter/Exit method block
• Jump from any message in a User Defined view to the All Messages view
• Go to a message by Line Number
• Advanced Search
• Quick Search (active view only)
• Message Type browse navigator
• Bookmarks

Message properties

This panel allows you to further inspect a selected message. You can view various Date Time values, Time Zone, Process Id, Thread Id, Request Id, Category, Machine Name, and so on. You can also extend the message Properties panel by attaching user-defined properties to single or multiple messages during logging:

2.png

Watches

Available only in the Live Viewer, the Watches panel allows you to display non-persistent information for quick and dirty data change. You can write directly to Watches or, if using the ReflectInsight PostSharp AOP extension, you can easily decorate an object property with a predefined custom attribute.
This attribute forces ReflectInsight to display the value of the property whenever its value changes:

3.png

Bookmarks

The Bookmarks panel allows you to view bookmarks for the current logging session:

4.png

It can be persisted with your log file for later retrieval. You can filter bookmarks for the active view or a given view, or see all the bookmarks across All Views. You can also navigate to any bookmark and immediately activate the view to select where the bookmarked message is located.

Call Stack

The Call Stack panel displays the Call Stack level of the current selected message. Call Stack entries are generated using the Enter/Exit methods, or if the message was contained within the TraceMethod using block.

You can easily navigate the Call Stack by double-clicking on a Call Stack entry, which will take you to the top of the Enter/Exit message block within the active message log panel:

5.png

Searching through your messages

The Live Viewer provides two ways to search messages by criteria, as shown in the following screenshot. They are Quick Search and Advanced Search. Quick Search is mainly used for simple, quick, text-based searching.
Advanced Search

This is primarily used to search messages where a more complex search criterion is needed. The search criteria can include a combination of the following:
• Message Content
• Message Type
• Content AND Message Type
• Content OR Message Type
• In addition to a Regular Expression

The Advanced Search view provides the ability to either navigate to the search result or bookmark it:

6.png

Time zone formatting

You can display your time details in either Standard or Military time formats. Select the Time Zone Type that best suits your location, such as Source, Local, UTC, or Custom (choosing from one of the available system time zones).

Auto Save/Purge

Apart from the library's ability to Auto Save rolling log files, the Live Viewer has similar capabilities in addition to Auto Purge, the top portion of a rolling log file. You can configure the Live Viewer to either Auto Save or Auto Purge by applying one of the following methods:

7.png

• Auto Save -This method forces the Live Viewer to save the files once a specific criterion has been met (that is, on a new day and/or message limit).
• Auto Purge -This method forces the Live Viewer to purge the top portion of the logged messages, based on predefined size percentages of the current log file.
If you look at the following screenshot, you can see the amount of information that may be gathered from your algorithms and applications—it's huge:

Example

Now that you know just how valuable a tool like Live Viewer is, it’s only fair for you to go through a hands-on example. Up next is a screenshot of an actual machine learning algorithm outputting data to the Live Viewer. Without this information in real time, you would be lost with respect to the efficacy and performance of your application!

**ReflectInsight Utilities: **

Message Statistics can be viewed and adjusted to meet your criteria with this incredibly valuable tool. You can search for various types of messages by names, categories, users, and more. From there you can see the composition of such messages.

8.png

Watches

Watches observe parameters and variables in real-time as shown below. You define your own watches programatically and periodically update their values and/or parameters:

9.png

Software Development Kit

The SDK is what allows you to connect ReflectInsight to your applications. The beautiful thing about how this SDK works compared to others is the rich image set assigned to each message. When you have thousands of messages streaming per second, colors and images can be a huge help in focusing your attention on just what you need to see.

The following is a screenshot that shows exactly what it means. As an example, if you use the SendException message, then the red X will be displayed in the icon panel along the far left-hand side of the Live Viewer/Log Viewer. The same applies for all the other messages you see in the following screenshot:

10.png

Configuration editor

The configuration editor is a visual interface into the ability to make configuration parameter changes for the application. This makes it simpler and more intuitive compared to changing text file parameters.

Overview

You can use the XML-based configuration file with your applications to make the ReflectInsight viewer behave the way you want it to. There are a few configuration categories available, from autosave and filtering, to message coloring and many more.

XML configuration

ReflectInsight is configured using an XML configuration file. The configuration information can be embedded within other XML configuration files, such as the application or web.config file, or in a separate file. The configuration is easily readable and updatable while retaining the flexibility to express all configurations.

Dynamic configuration

ReflectInsight automatically monitors its configuration file for changes and dynamically applies these changes when made. In many cases, it is possible to diagnose application issues without terminating the process in question. This can be a very valuable tool in investigating issues from your deployed applications.

Main Screen

The ReflectInsight insight configuration editor helps in easily creating configuration files through a visual interface, but advanced users can work with XML.

The tool is very useful for editing settings, defining message patterns/formats, defining extensions, defining listeners, associating colors with message types, and more:
• Easy-to-understand layout
• It remembers the recent files list
• Predefined selections and dynamic section lookups
• Key values popup editor
• Message pattern popup editor
• Method types popup editor
• Color definition and message color popup editor

The following is a screenshot of the configuration editor and the various parameters its changes can affect:

11.png

You can download a trial copy of ReflectInsight from www.reflectsoftware.com. If you enjoyed this article and would like to learn more about machine learning, you can explore Hands-On Machine Learning with C#, an end-to-end guide to learning machine learning concepts and techniques with practical implementations.

Discover and read more posts from PACKT
get started
post commentsBe the first to share your opinion
Ross Pellegrino
5 years ago

Hey Matt, great article! Definitely will buy your book. Machine learning is my favorite topic.

Show more replies