Wf4: ETW follows participants

Source: Internet
Author: User

In wf4, the tracking service is used to track the tracing records that the participants directly listen to during running and process them according to the selected method. We can record logs to different media. In this article, we will look at the ETW tracking participants supported by wf4.

Windows event tracking (ETW) is a high-speed and common tracking tool provided by the operating system. ETW uses the buffer and logging mechanism implemented in the kernel to provide user-mode applications.ProgramAnd the tracking mechanism of events caused by kernel-mode device drivers. In addition, ETW allows you to dynamically enable and Disable Logging and easily perform detailed tracing in the actual production environment without restarting the system or applications. The logging mechanism uses the buffer of each processor, which is written to the disk by the asynchronous write thread. In this way, the interference of Large server applications when writing events can be minimized.

We create a workflow project. In the workflow design, we can add a few activities as needed, as shown below:

Let's take a look at how to configure the ETW tracking,CodeAs follows:

// ETW tracking setup

Trackingprofile = new trackingprofile ();

Trackingprofile. Queries. Add (New workflowinstancequery

{

States = {"*"}

});

Trackingprofile. Queries. Add (New activitystatequery

{

States = {"*"}

});

Trackingprofile. Queries. Add (New customtrackingquery

{

Activityname = "*",

Name = "*"

});

Etwtrackingparticipant ipant = new etwtrackingparticipant ipant ();

Etwtrackingparticipant ipant. trackingprofile = trackingprofile;

In the above code, we can choose to record the tracing information, which is completed by tracking the configuration file and can be customized according to your needs, after that, we need to add etwtrackingparticipant ipant to the workflow as an extension point. The Code is as follows:

Autoresetevent = new autoresetevent (false );

Workflowapplication = new workflowapplication (New workflow1 ());

Workflowapplication. Completed = (ARG) =>{ autoresetevent. Set ();};

Workflowapplication. Extensions. Add (etwtrackingparticipant ipant );

Workflowapplication. Run ();

Autoresetevent. waitone ();

Then we run the workflow, and the result is very simple:

Open the windows Event Viewer and switch to the location where relevant information is recorded. This is the information after the workflow is run:

We can see the details of Workflow running as follows:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.