locked
Asynchronous logging using logging application block RRS feed

  • Question

  • User-1776167502 posted

    Hi,

     Is it possible to have Asynchronous logging using LAB?

    I also wanted to know the advantages of LAB over Log4Net.

    Or should I go for writing my own asynchronous logger?

     

    Please Help,

    Robin

    Friday, June 6, 2008 12:19 PM

Answers

  • User579345625 posted

    Hi, 

    Is it possible to have Asynchronous logging using LAB?

    NO the LAB is not Asynchronous by default.  But you can make it Asynchronous using MSMQ 

    I also wanted to know the advantages of LAB over Log4Net.
     

     LAB is one of the most complex application block articture wise. it supports many listeners and it is highly configurable.

    And advantage over the the Log4Net: May be because it is Microsoft Initative :)

    should I go for writing my own asynchronous logger?

    Yes, if you want a lightweight logger, which only logs to a file or event logger, then go for writing your own Asynchronous logger.

     

    Following post will give you more info as well as some useful links:

    http://forums.asp.net/p/1117624/1736413.aspx#1736413

     

    Hope this helps,

     

    Thanks,

    Anup

     


    Always remember to click 'Mark as Answer' on the post that helps you.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 9, 2008 12:49 AM
  • User579345625 posted

     Hi Rob,

     Few Suggestions:

    1. Make the logger class singleton

    2. Keep a queue of log messages in Logger class

    3. Current threads will just add the records to the queue and will not do actual I/O operation (so performance is assured)

    4. Run a separate thread in Logger class which will periodically access the queue and to log the messages in file or whatever the destination is.

     

    You have to be very careful about the race and deadlocks in this case. Thus may have to do proper synchronization

     

    Thanks,

    Anup

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 20, 2008 6:39 AM
  • User579345625 posted

    Hi Rob,

     Following is the best book  on threading

    Threading in C# by Joseph Albahari

    http://geekswithblogs.net/ram/archive/2006/06/16/82078.aspx

     

    Hope this helps  

    Thanks,

    Anup

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 23, 2008 11:23 PM

All replies

  • User579345625 posted

    Hi, 

    Is it possible to have Asynchronous logging using LAB?

    NO the LAB is not Asynchronous by default.  But you can make it Asynchronous using MSMQ 

    I also wanted to know the advantages of LAB over Log4Net.
     

     LAB is one of the most complex application block articture wise. it supports many listeners and it is highly configurable.

    And advantage over the the Log4Net: May be because it is Microsoft Initative :)

    should I go for writing my own asynchronous logger?

    Yes, if you want a lightweight logger, which only logs to a file or event logger, then go for writing your own Asynchronous logger.

     

    Following post will give you more info as well as some useful links:

    http://forums.asp.net/p/1117624/1736413.aspx#1736413

     

    Hope this helps,

     

    Thanks,

    Anup

     


    Always remember to click 'Mark as Answer' on the post that helps you.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 9, 2008 12:49 AM
  • User-1776167502 posted

    Hi Anup,

    Thank you very mukch for this, you answered all the questions!

     Best Regards,

    Rob

     

     

     

    Monday, June 9, 2008 1:06 AM
  • User-1776167502 posted

     Hi Anup,

     

    Can you please give me some pointers on how to make my logger asynchronous?

     

    Thanks,

    Rob

    Friday, June 20, 2008 6:17 AM
  • User-1776167502 posted

     Hi Anup,

     

    Can you please give me some pointers on how to make my logger asynchronous?

     

    Thanks,

    Rob

    Friday, June 20, 2008 6:28 AM
  • User579345625 posted

     Hi Rob,

     Few Suggestions:

    1. Make the logger class singleton

    2. Keep a queue of log messages in Logger class

    3. Current threads will just add the records to the queue and will not do actual I/O operation (so performance is assured)

    4. Run a separate thread in Logger class which will periodically access the queue and to log the messages in file or whatever the destination is.

     

    You have to be very careful about the race and deadlocks in this case. Thus may have to do proper synchronization

     

    Thanks,

    Anup

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 20, 2008 6:39 AM
  • User-1776167502 posted

     Hi Anup,

     

    Thanks for these valuable suggestions. Could you please forward me some good link to start on threading?

     

    Regards,

    Rob

     

    Friday, June 20, 2008 6:45 AM
  • User579345625 posted

    Hi Rob,

     Following is the best book  on threading

    Threading in C# by Joseph Albahari

    http://geekswithblogs.net/ram/archive/2006/06/16/82078.aspx

     

    Hope this helps  

    Thanks,

    Anup

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, June 23, 2008 11:23 PM