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:
- How logging impacts in performance? is it possible/recomendable logging using async calls?
- 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.
- 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.
Having logging/tracing is extremely valuable – at the very very least you should log errors, or you’ll never know about them. Most logging apis let you turn on and off the level of detail you need logged.
Don’t worry about performance until it becomes a problem. It’s not like you’re building moon rockets and wants to see how much weight it can carry by testing it – it’s just code, remove the logging statements that flood your logs and recompile if it ever becomes a problem.