We want to go deeper on logging at work and are planning to log virtually every important thing happening in our system, such as the audit operations performed on DB tables and other business operations happening in the system and in the services thereof, which will probably generate thousands of records every couple of hours.
The logging system should – of course- be easy to use and configure, and able to be queried real-time.
My questions are:
1) Can “the audit operations on DB” part be handled by SQL-Server itself? Does it have its own logging mechanism?
2) How and where can we log other business operations?
First framework that comes to my mind is log4net, but I’m still not sure where to log them as we don’t want to overfill the DB all the time. Is using a whole different DB just for logging purposes, or producing text files out of DB periodically and zipping them, etc. a good way? How do enormous systems handle this kind of elaborated logging processes?
Log4Net has a whole bunch of appenders you can configure in the app.config and change without need to rebuild anything, you can have database appenders, SmtpAppenders, rolling file appenders and many many others, with no special coding I got it working and sending me emails using SmtpAppender for some small applications. If you then decide to change appender you only touch the configuration.
SQL server supports audit and change tracking, those should have all you need and even more, be careful that in general if you enable too many things then you may have a performance issue.