Quantcast
Channel: eInfoBuzz » Application Performance
Viewing all articles
Browse latest Browse all 4

Application delay or hanging due to log4j

$
0
0

Application delay or hanging due to log4j

While profiling one of my multi-threaded applications, I found that some of my threads are in blocked state as some other thread is busy using the shared resource. The thread monitor was org.apache.log4j.spi.RootLogger which was blocking my threads. Finding the stack trace of the thread I found that the threads are using Log4j to write on the console using console appender and it is writing it serially therefore creating delay in my application.

Solution

The simple solution to this problem is to use AsyncAppender, using AsyncAppender with log4j usually is a good idea but the only problem is that  AsynAppender buffer is not flushed completely on application exit.


Viewing all articles
Browse latest Browse all 4

Trending Articles