Logging strategy vs. performance

Posted by vtortola on Stack Overflow See other posts from Stack Overflow or by vtortola
Published on 2010-04-12T21:56:25Z Indexed on 2010/04/12 22:53 UTC
Read the original article Hit count: 510

Hi,

I'm developing a web application that has to support lots of simultaneous requests, and I'd like to keep it fast enough. I have now to implement a logging strategy, I'm gonna use log4net, but ... what and how should I log? I mean:

  1. How logging impacts in performance? is it possible/recomendable logging using async calls?
  2. Is better use a text file or a database? Is it possible to do it conditional? for example, default log to the database, and if it fails, the switch to a text file.
  3. What about multithreading? should I care about synchronization when I use log4net? or it's thread safe out of the box?

In the requirements appear that the application should cache a couple of things per request, and I'm afraid of the performance impact of that.

Cheers.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about log4net