designing a logger for a component(dll) RRS feed

  • Question

  • Dear all,

    I need one design advise.I am developing a .net component(dll) in .net 2.0 for some back ground activities...The dll is using by a GUI application and it has one logger window, such that it displays the various actvities done by the end user. I want to display the log messages from the dll into this window. My component has a lot of classes. But I would like to expose only one class outside. I thought about event handling mechanism...Even if you are creating an event for the exposed class, only the messges from that class will be available. I want to display the messages from the functions in other classes also in the logger window of the client application. I dont want to use any remoting or any advanced technology. How can I do this? Kindly give some suggetions. If any sample codes are also welcome...

    Thanks in advance...


    • Moved by jack 321 Monday, June 2, 2008 7:17 AM off topic
    Thursday, May 29, 2008 8:29 AM


All replies

  • I would use the builtin trace facilities of .NET rather than building my own.  .NET supports the concept of trace sources.  These sources can be used to group messages by component.  Additionally you can filter out sources or event types.  It is pretty easy to create a UI control that listens on the trace events and updates a control.  I have used textboxes and treeviews in the past with great success.  The biggest thing to remember is that tracing can happen on any thread so all UI updates must be marshalled to the UI thread. 


    The only real downside to the trace facilities in .NET is that somebody at MS decided it needed a lot of useless information such that the default trace messages are ugly, large and useless.  Therefore you'll want to edit the actual message.


    Michael Taylor - 5/28/08



    Thursday, May 29, 2008 12:48 PM
  • Hello Taylor,
    Thank you very much for your reply..I tried using TraceSource inside the dll and used the methods TraceInformation() and TraceData() for writing. But I dont know how can get those messages in the client exe. Since TraceListeners are available only for console, text and Event viewer, how can display these trace messages into a rich text box. Can I have any sample code for the same.
    Friday, May 30, 2008 6:32 AM
  • This was moved out of the forum.

    You can ask this question in another forum.

    Or I can move this to a specific forum if you'd like.


    Ed Price a.k.a User Ed, Microsoft Experience Program Manager (Blog, Twitter, Wiki)
    Sunday, January 8, 2012 6:46 AM