Application delay or hanging due to log4j

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.


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.

One Response to “Application delay or hanging due to log4j”

  1. If you desire to improve your knowledge simply keep visiting
    this web site and be updated with the newest news posted here.

Leave a Reply

Spam Protection by WP-SpamFree

Einfobuzz Site Map