EventBroker: How to trace all events passed through EventBroker

Topics: CAB & Smart Client Software Factory
May 8, 2007 at 9:37 AM
Hi,

Is there a way to trace/log all events fired through EventBroker?


-
Thanks,
Leonid
May 8, 2007 at 10:04 AM
Hi Leonid,

Yup, the EventBroker code inside ComponentUI writes to the standard Trace stream.

You can add a Trace Listener through the system.Diagnostics configuration section to listen for the trace events...
The class is something like Microsoft.Practices.ComponentUI.EventBroker.EventTopic (if you have reflector have a look in the ComponentUI assembly. It has events like Fire which all write to trace.

Sorry but I don't have reflector near me so can't be any more precise! It works though. I did it earlier today!!

Graeme

May 9, 2007 at 10:07 AM
Isn't it easier to just read the source code ? :-P

--larsw
May 9, 2007 at 3:29 PM
yeah :)
I've found the trace source name to listen

  <system.diagnostics>
    <sources>
      <source name="Microsoft.Practices.ObjectBuilder" switchName="Switch1">
        <listeners>
          <add name="Console" type="System.Diagnostics.ConsoleTraceListener" />
        </listeners>
      </source>
    </sources>
    <switches>
      <add name="Switch1" value="Information" />
    </switches>
  </system.diagnostics>


-
Thanks,
Leonid