Reputation: 515
Is it considered best practice to use file appenders or database appenders in log4net?
This is in a web farm environment hence I'm finding it a struggle managing multiple files for multiple sites - is the database a better way to go, and if so, are there any issues?
I've seen some people complain of connection pooling issues for example
My environment is MVC + NHibernate
Upvotes: 0
Views: 807
Reputation: 5021
or a shared file system and write a file (assuming your web farm is all part of the same company)
.. the other thing that you can do is a hybrid strategy, where you write detailed data to a file, and summary (perhaps INFO level and above) to a network socket
Upvotes: 0
Reputation: 349
BY default logging is not asynchronous. Logging to a database is much more expensive than logging to files, but the beauty of Log4Net is you can start with one store and switch if needed.
Upvotes: 1
Reputation: 15673
I'd contend the best choice is what works in your environment, which seems to be database given the farm.
Beauty of log4net is this is all just a configuration switch so switching back to files after the database don't help isn't painful nor expensive. You can even log to multiple things if you so choose -- eg, trace debug stuff locally, auditing events go to the db and "the server is down" goes to some admin's email address.
Upvotes: 0