How to buffer in SQL Listener?

Topics: Logging Application Block
Apr 6, 2014 at 12:21 AM
Edited Apr 6, 2014 at 1:08 AM
Our existing application is using Enterprise Library Logging block version 5.0. I'm planning to change the Listener from Event Source listener to SQL Listener.
1>Is there anyway to buffer messages in sql listener? and if there is a way then how do i configure it? any examples?
2>Does the logging occurs on different thread or same as application's thread?
Apr 8, 2014 at 5:09 AM
Out of the box in Enterprise Library 5 there is no way to buffer messages. You would have to write a buffering mechanism (either inside a custom trace listener or some other means outside of Enterprise Library).

Enterprise Library 6 introduced the AsynchronousTraceListenerWrapper which will allows you to use Logging Asynchronously.

Yes, logging will occur on a different thread. If you are using the XML configuration you can set the Asynchronous property to true (as well as the Buffer Size, Degree of parallelism, and Dispose Timeout if you wish). For programmatic configuration then you can use the AddAsynchronousTraceListener extension method:
config.AddLogSource("AsyncDatabase", SourceLevels.All, true)
  .AddAsynchronousTraceListener(databaseTraceListener);
~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to
Marked as answer by lax4u on 4/8/2014 at 8:36 PM