Skip to content
This repository was archived by the owner on Feb 15, 2023. It is now read-only.

Demonstrating Semantic Logging using a Console Sink

jeff starkey edited this page Apr 2, 2017 · 1 revision

Quick Nav

Steps to setting things up


This page covers what you need to know about installation, configuration, and use of a console application provided by Microsoft to support demonstration of ETW. This page ties in with the SemanticLogging demo application as it calls out various settings.

Example Log Entries to Console Sink

Console with both event levels set to Informational. If/when the event levels are set differently in the event sink configuration, then the output show here will be include a different set of entries.

D:\GitHub\SemanticLogging\packages\EnterpriseLibrary.SemanticLogging.Service.2.0.1406.1\tools>SemanticLogging-svc.exe -console
Enterprise Library Semantic Logging Service v2.0.1406.1
Microsoft Enterprise Library
Microsoft Corporation


Configuration settings loaded from file: D:\GitHub\SemanticLogging\packages\EnterpriseLibrary.SemanticLogging.Service.2.0.1406.1\tools\SemanticLogging
-svc.xml

Event Trace Session prefix: Microsoft-SemanticLogging-Etw

Sink name: ConsoleEventSink
Event sources:
Name: 640281d7-abbb-5c4c-efd1-c0e94ff88e8c
SemanticLogging-DemoConsole-EventSource, Level: Informational, MatchAnyKeyword: None
Name: 9740e5f5-be04-586e-bbe1-0562eaef0eec
SemanticLogging-SemanticLogging-EventSource, Level: Informational, MatchAnyKeyword: None

Service started.

Press enter to end ...
+==============Demo of ETW Out-Of-Process Logging to Console==================+
EventId : 100, Level : Informational, Message : Example of Console Application Name start, Payload : [applicationName : Example of Console Application
 Name] , EventName : Start, Timestamp : 2017-03-31T01:48:51.7081164Z, ProcessId : 12908, ThreadId : 14132

+==============Demo of ETW Out-Of-Process Logging to Console==================+
EventId : 100, Level : Informational, Message : Configuration start for Example of Library Name, Payload : [applicationName : Example of Library Name]
 , EventName : Start, Timestamp : 2017-03-31T01:48:51.7094913Z, ProcessId : 12908, ThreadId : 14132

+==============Demo of ETW Out-Of-Process Logging to Console==================+
EventId : 120, Level : Informational, Message : Row processed for 1, Payload : [rowIdentifier : 1] [applicationName : Example of Library Name] , Event
Name : Start, Timestamp : 2017-03-31T01:48:51.7096411Z, ProcessId : 12908, ThreadId : 14132

+==============Demo of ETW Out-Of-Process Logging to Console==================+
EventId : 120, Level : Informational, Message : Row processed for 2, Payload : [rowIdentifier : 2] [applicationName : Example of Library Name] , Event
Name : Start, Timestamp : 2017-03-31T01:48:51.7096430Z, ProcessId : 12908, ThreadId : 14132

+==============Demo of ETW Out-Of-Process Logging to Console==================+
EventId : 120, Level : Informational, Message : Row processed for 3, Payload : [rowIdentifier : 3] [applicationName : Example of Library Name] , Event
Name : Start, Timestamp : 2017-03-31T01:48:51.7096441Z, ProcessId : 12908, ThreadId : 14132

+==============Demo of ETW Out-Of-Process Logging to Console==================+
EventId : 120, Level : Informational, Message : Row processed for 4, Payload : [rowIdentifier : 4] [applicationName : Example of Library Name] , Event
Name : Start, Timestamp : 2017-03-31T01:48:51.7096449Z, ProcessId : 12908, ThreadId : 14132

+==============Demo of ETW Out-Of-Process Logging to Console==================+
EventId : 140, Level : Informational, Message : Processing row 5 failed: Exception to Show Failure, Payload : [rowIdentifier : 5] [exceptionMessage :
Exception to Show Failure] [applicationName : Example of Library Name] , EventName : Suspend, Timestamp : 2017-03-31T01:48:51.7098023Z, ProcessId : 12
908, ThreadId : 14132

+==============Demo of ETW Out-Of-Process Logging to Console==================+
EventId : 160, Level : Informational, Message : Message processor stop for Example of Library Name, Payload : [applicationName : Example of Library Na
me] , EventName : Stop, Timestamp : 2017-03-31T01:48:51.7099125Z, ProcessId : 12908, ThreadId : 14132

Steps to Setting Up the Out-of-Process Console Sink

Pre-reqs

This demonstration console needs to be installed after you've successfully cloned the SemanticLogging application. This is simply because the clone to your machine will give a handy location for installation of the ETW Console application.

Install the kit

Find the "Key Links" list below, and click through to the installation process. This is a great resource. In addition to this installation guide (the link below), here are a few pro-tips:

  • In install step 2, it says to search for "semantic logging service." Step 3 is to install the "Semantic Logging Application Block - Out-of-process Service." What this really meant for me was to install "EnterpriseLibrary.SematicLogging.Service." The description of this package gives you the clue you need. Here is the key portion of the text... "This package contains an out-of-proc Windows Service for SLAB."
  • Installation of the app in step 6 using Powershell will benefit from running the command from a CMD window that has been opened with "Run as administrator...". Here's how.
  • Stop installation steps after step 6. We don't intend to run this as a Windows Service. Do not do steps 7 and 8.

Here's what the installation should look like.

Configure the kit

Here is where this post strays from the defaults given in the package just installed. The configuration is set to "sink" or capture events into a flat file. And while your application may really groove on files, I can't help but find them.....flat (ouch...!).

I've included a copy of the XML configuration file that I used to send ETW traces to the Console. Here are details for Configuring the Console Sink.

Here's what the configuration should look like.

Key Links

Installing and running the Out-of-Process Windows Service/Console Host

Clone this wiki locally