I am working on a multithreaded application. I am already using Log4j to log statements to files.
I have been recently looking into the possibility of logging to a Mysql database.
The logging component has to be reliable under a heavy load and has to be thread safe.
I heard of SFL4J. My understanding of SLF4J is that is just a facade or abstraction layer.
- I was wondering if SLF4J was a good database logging solution to use in a
multithreaded application?
- And in the case of a heavy load, would it be a good idea to add a layer (like a buffer or a queue) and let the threads log to it instead of calling the logging thread directly (The logging thread would send the statements found in the queue one by one to the database)?
Any tips, best practices or code example would greatly be appreciated,
Regards,