java - log4j in a multithread environment. One Appender per Thread or one Logger per Thread or...? -
in multithreaded environment (web service provider) need create log entries in database per request (normally per thread). approach use this? same logger threads , create appender per thread. @ end of request/thread close/remove appender. a logger per thread (different class name per thread). @ end of request/thread somehow release specific logger other? from apache log4j faq : yes, log4j thread-safe. log4j components designed used in heavily multithreaded systems. as marko topolnik comments, ignore multithreading when planning logging statements, , let log4j take care of it.