如何在C#中使用ETW实现远程日志记录 [英] How to implement remote logging using ETW in C#

查看:123
本文介绍了如何在C#中使用ETW实现远程日志记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 



我们已经在C#中实现了ETW日志记录,如果我们将日志放在本地机器上,它工作正常。本地机器的C#代码
如下:




          private void button1_Click(object sender,EventArgs e)

        {

            var provider = new EventProvider(new Guid(" {CDDA7178-6A9D-4C86-860B-4074116458BC}"));



            System.Diagnostics.Eventing.EventDescriptor描述符;

           未经检查

            {

                //  EventDescriptor(int id,byte version,byte
channel,byte level,byte opcode,int task,long keywords);


                descriptor = new System.Diagnostics.Eventing.EventDescriptor(0x7d1,
0x1,0x9,0x2,0x0,0x0,(long)0x4000000000000000); //关键字


            }



&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; for(int i = 0; i< 5; i ++)

  &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; {

&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; provider.WriteEvent(ref descriptor,i);  

&NBSP; &NBSP; &NBSP; &NBSP; &NBSP; &NBSP; }

&NBSP; &NBSP; &NBSP; &NBSP; }



我对重载方法的使用感到困惑 - > provider.WriteEvent(ref描述符,eventPayload);
//其中eventPayload是一个对象数组。 




我想通过使用相同的ETW机制在远程机器上实现日志。请提供解决方案。



谢谢

Hi, 

We have implemented ETW logging in C# and it is working fine if we put logs on local machine. The C# code for local machine are as follow:

         private void button1_Click(object sender, EventArgs e)
        {
            var provider = new EventProvider(new Guid("{CDDA7178-6A9D-4C86-860B-4074116458BC}"));

            System.Diagnostics.Eventing.EventDescriptor descriptor;
            unchecked
            {
                //  EventDescriptor(int id, byte version, byte channel, byte level, byte opcode, int task, long keywords);
                descriptor = new System.Diagnostics.Eventing.EventDescriptor(0x7d1, 0x1, 0x9, 0x2, 0x0, 0x0, (long)0x4000000000000000); // Keywords
            }

            for (int i = 0; i < 5; i++)
            {
                provider.WriteEvent(ref descriptor, i);  
            }
        }

I am confused about the usage of overloaded method -> provider.WriteEvent(ref descriptor, eventPayload); // where eventPayload is an object array. 

I want to implement logs on remote machine by using the same ETW mechanism. Kindly provide the solutions.

Thanks

推荐答案

DX适用于C ++开发人员,错误论坛

DX is for C++ developer, wrong forum

尝试
here

这是用于游戏开发等


这篇关于如何在C#中使用ETW实现远程日志记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆