如何将跟踪侦听器附加到正在运行的进程? [英] How do I attach a trace listener to a running process?

查看:143
本文介绍了如何将跟踪侦听器附加到正在运行的进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道这是否可能以我想像的方式进行,所以我希望有人可以帮助我绕过这个。

I'm not sure if this is possible in the manner I am envisioning or not so I'm hoping someone can help me wrap my head around this.

我想要在一个正在运行的进程中注入一个TraceListener。我实际上并不关心我如何附加到这个进程,但是最终目标是监听正在运行的进程的跟踪输出并将其转储到控制台窗口。

I'm wanting to inject a TraceListener into a running process - kind of. I don't actually care how I attach to the process, but the end goal is to listen to the trace output of the running process and dump it out to a console window.

我可以附加到进程好了,我可以写一个TraceListener好的...我要来的是不停的是中间的位。任何人都可以得到任何线索,如果这可以做到?如果是这样,可以给我一个推动正确的方向,因为我看不到森林在这里的树木。

I can attach to the process okay, and I can write a TraceListener okay... where I'm coming unstuck is the bit in the middle. Anyone got any clue if this can be done? If so, can you give me a push in the right direction because I can't see the forest for the trees here.

也许我试图接近这个错误的方式?

Maybe I'm trying to approach this in the wrong way?

推荐答案

我不认为这是实用的。在运行时创建一个监听器是很容易的,但这是应用程序必须做的,它涉及到添加一些列表。

I don't think this is practical. It would be easy to create a listener at runtime, but that is something the App has to do, it involves adding something to a list.

你可能想确保默认监听器不会被删除,并使用 OutputDebug工具来监听in。

You may want to make sure the Default listener isn't removed and use an OutputDebug tool to listen in.

这篇关于如何将跟踪侦听器附加到正在运行的进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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