Please let me know your suggestions about how to design logging and how to test it, in the following scenario.
I’ve an API which can be called by multiple threads. One call of this API by a single thread generates a log of 50 KB.
Does any design pattern exist for logging in multi-threaded environment. i.e one log file for all threads vs one dedicated log file for each thread?
And, How to do testing for this feature. (should it be tested?)
Thanks.
Wrap your logging instance in a thread-safe singleton. Don’t use double check locking! Also, it probably makes sense to use a logging library like log4net or Enterprise Library 5.