Dominick challenged me the other day...
For being able to better log information, warning and error messages in a truly distributed development, testing and operation environment, I built a sample custom TraceListener which leverages the Service Bus to pump tracing messages into the cloud.
Currently I am using the message-buffer-based volatile queuing mechanism in the Service Bus, but will move on to the Queue features introduced in the March 2009 bits soon.
There is a very simple ServiceContract I am using:
[ServiceContract(ConfigurationName = "Thinktecture.ServiceBusTraceListener")]
public interface IMessageTracing
{
[OperationContract(IsOneWay = true)]
void WriteMessage(string message);
}
All the magic is done in my custom TraceListener implementation. Here is a snippet of the relevant boilerplate code:
public class ServiceBusTraceListener : TraceListener
{
...
public ServiceBusTraceListener()
: base("Thinktecture.ServiceBusTraceListener")
{
CreateInMemoryQueue();
SpawnWorkerThread();
}
...
public override void Write(string message)
{
WriteLine(message);
}
public override void WriteLine(string message)
{
traceMessagesQueue.Enqueue(message);
}
...
}
This simple implementation uses a thread-safe in-memory queue data structure which is filled from within the TraceListener's WriteLine method. On 'the other side' of the queue there is a consuming thread which reads the messages from the queue (the in-memory one) and sends them to the Service Bus via a NetEventRelayBinding-enabled channel.
The background thread doing the Service Bus communication picks up all relevant WCF configuration from the config file (convention-based).
Download the sample solution.
Awesome! What a cool idea. Nice work as usual guys…
Posted by: an essay | 07/26/2010 at 12:43 AM
THANX ALOT FOR THIS IT HAS HELPED ME A GREAT DEAL
KEEP IT UP
Posted by: essay writing services | 08/23/2010 at 04:10 PM
hi
Excellent work as usual. Chill out about the updates though, we're good as long as you keep up with it...G8
Posted by: academic papers | 08/23/2010 at 05:30 PM
that is so pretty! what a fantastic idea.
Posted by: an essay | 09/30/2010 at 03:45 AM
I really LOVE it!!!!!
Posted by: essay writing services | 10/01/2010 at 02:59 AM
thanks about this, this is very advantage for my study tasks,I hope this website will be survive to help the others student.
thank you……
.
Posted by: Term Paper | 10/04/2010 at 12:26 AM
*Nobody can stop the wheel of history.
Posted by: Air Jordans | 12/13/2010 at 02:17 AM
I've been reading your post and I think have very good information, I would like to know the methodology you use to write your post.
Posted by: Inversiones en oro | 04/12/2011 at 05:50 PM
******Have you ever seen somebody lick the chutney spoon in an Indian Restaurant and put it back?
This would never have happened under the Tories.***
Posted by: vibram toe shoes | 05/16/2011 at 08:45 AM