multithreaded logging for high performance application

Viewed 27814

I have an application (server application) that needs an extensive amount of logging implemented and shouldn't be too affected performance wise by enabling logging.

The application has a thread pool of worker threads performing the work. Originally I was going to just log on these thread pool threads, but then I'd need to lock practically the whole thread and so there goes my 'multithreaded' app.

I have been looking at better ways to log from multiple threads and I've found using a Queue or ring buffer could be an idea.

Can anybody suggest (perhaps from experience) any good ways to implement effective logging (to a file mostly) for a multithreaded application that also should stay somewhat performant?

I would like to use the Boost Logging Library.

6 Answers
Related