Home > .NET Development > C# Enterprise Library Asynchronous Logging

C# Enterprise Library Asynchronous Logging


We all know how slow any logging mechanism is, specially when one of the trace listeners is logging to a database. By using .NET 4.0 with it’s Parallel Library (System.Threading.Task) we can easily turn our logger to use fire-forget asynchronous operation.

 Example below uses Enterprise Library 5.0.

Suppose this is your existing LogMessage method:

Just add another method LogMessageAsync with ff code:

Now to log asynchronously just call the LogMessageAsync() method.

 

 

Advertisements
  1. June 15, 2012 at 1:34 pm

    Hi, I do think this is a great web site. I stumbledupon it 😉 I
    may return yet again since I bookmarked it.
    Money and freedom is the greatest way to change, may you
    be rich and continue to guide others.

  1. October 3, 2011 at 2:13 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: