Print Page | Close Window

Intercepting messages being written to DebugLog.xml in BOS

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=835
Printed Date: 11-Jun-2026 at 8:58am


Topic: Intercepting messages being written to DebugLog.xml in BOS
Posted By: pnschofield
Subject: Intercepting messages being written to DebugLog.xml in BOS
Date Posted: 10-Jun-2008 at 1:49pm
We've implementing the Enterprise Library Logging Application Block in our PersistenceManager implementation so that we can perform server-side logging.  We'd like to be able to log messages that the IdeaBlade framework is currently writing to the DebugLog.xml file to our own logs.  I've seen the documentation on the TracePublisher/Subscriber classes, but they seem to be designed for passing trace messages from the server to a client; we just need to see the trace messages on the server as they happen.

Any suggestions?



Replies:
Posted By: kimj
Date Posted: 11-Jun-2008 at 7:47am
You can directly create an instance of IdeaBlade.Util.TraceSubscriber, and then subscribe to its Publish event.  We have two concrete implementations of the TraceSubscriber based on the communications technology choice:  Remoting or WCF.  We use the TraceSubscriber in both the TraceViewer and the debug log, so you'd effectively be doing the same thing we are. 
 
I'm not sure how well we've documented all this, so here's a little bit to get you started:
 
// Creates either WCF or Remoting instance based on IdeaBladeConfig.
// Overloads are available, or construct the concrete class directly.
_traceSubscriber = TraceSubscriber.CreateInstance();  
 
// The publish handler will be where you take the trace message and log to your own logs.
_traceSubscriber.Publish += PublishHandler;
_traceSubscriber.SubscriptionError += SubscriptionErrorHandler;
 
// This is overloaded - I'm not sure which you'd need.
_traceSubscriber.StartSubscription(url);
 
// You can issue this when done.
_traceSubscriber.StopSubscription();
 
 



Print Page | Close Window