title: Log4j Logger class loading blocks application threads
body: <p>Threads got BLOCKED when application threads heavily tried to log. Has this been encountered before. Does Async logger solve problems around this. Below is the thread dump indicating application threads getting BLOCKED when it was trying to heavily log exceptions. Multiple threads got into a BLOCKED state</p>
  <pre><code>&quot;app[LARLAca][TG][T#7]&quot; #55 daemon prio=5 os_prio=0 tid=0x00007f2de800b800 nid=0x2fee runnable [0x00007f2e048ee000]
     java.lang.Thread.State: RUNNABLE
      at java.util.zip.ZipFile.getEntry(Native Method)
      at java.util.zip.ZipFile.getEntry(ZipFile.java:316)
      - locked &lt;0x00007f2f5c2e1310&gt; (a java.util.jar.JarFile)
      at java.util.jar.JarFile.getEntry(JarFile.java:240)
      at java.util.jar.JarFile.getJarEntry(JarFile.java:223)
      at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:1054)
      at sun.misc.URLClassPath.getResource(URLClassPath.java:249)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
      - locked &lt;0x00007f2f5e3c4d30&gt; (a java.lang.Object)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
      at org.apache.logging.log4j.core.util.Loader.loadClass(Loader.java:240)
      at org.apache.logging.log4j.core.impl.ThrowableProxy.loadClass(ThrowableProxy.java:633)
      at org.apache.logging.log4j.core.impl.ThrowableProxy.loadClass(ThrowableProxy.java:624)
      at org.apache.logging.log4j.core.impl.ThrowableProxy.toExtendedStackTrace(ThrowableProxy.java:738)
      at org.apache.logging.log4j.core.impl.ThrowableProxy.&lt;init&gt;(ThrowableProxy.java:138)
      at org.apache.logging.log4j.core.impl.ThrowableProxy.&lt;init&gt;(ThrowableProxy.java:122)
      at org.apache.logging.log4j.core.impl.Log4jLogEvent.getThrownProxy(Log4jLogEvent.java:605)
      at org.apache.logging.log4j.core.pattern.ExtendedThrowablePatternConverter.format(ExtendedThrowablePatternConverter.java:64)
      at org.apache.logging.log4j.core.pattern.PatternFormatter.format(PatternFormatter.java:38)
      at org.apache.logging.log4j.core.layout.PatternLayout$PatternSerializer.toSerializable(PatternLayout.java:334)
      at org.apache.logging.log4j.core.layout.PatternLayout.toText(PatternLayout.java:233)
      at org.apache.logging.log4j.core.layout.PatternLayout.encode(PatternLayout.java:218)
      at org.apache.logging.log4j.core.layout.PatternLayout.encode(PatternLayout.java:58)
      at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.directEncodeEvent(AbstractOutputStreamAppender.java:177)
      at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.tryAppend(AbstractOutputStreamAppender.java:170)
      at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:161)
      at org.apache.logging.log4j.core.appender.RollingFileAppender.append(RollingFileAppender.java:309)
      at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:156)
      at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:129)
      at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:120)
      at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84)
      at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:464)
      at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:448)
      at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:431)
      at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:406)
      at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:63)
      at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:146)
      at org.apache.logging.log4j.spi.AbstractLogger.tryLogMessage(AbstractLogger.java:2170)
      at org.apache.logging.log4j.spi.AbstractLogger.logMessageTrackRecursion(AbstractLogger.java:2125)
      at org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2108)
      at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1991)
      at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1835)
      at org.apache.logging.log4j.spi.AbstractLogger.warn(AbstractLogger.java:2684)
  </code></pre>
  <pre><code>&quot;app[LARLAca][TG][T#1]&quot; #44 daemon prio=5 os_prio=0 tid=0x00007f36fe6b3000 nid=0x2fe3 waiting for monitor entry [0x00007f2e06bfb000]
     java.lang.Thread.State: BLOCKED (on object monitor)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:399)
      - waiting to lock &lt;0x00007f2f5e3c4d30&gt; (a java.lang.Object)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:264)
      at org.apache.logging.log4j.util.LoaderUtil.loadClass(LoaderUtil.java:168)
      at org.apache.logging.log4j.core.impl.ThrowableProxy.loadClass(ThrowableProxy.java:622)
      at org.apache.logging.log4j.core.impl.ThrowableProxy.toExtendedStackTrace(ThrowableProxy.java:738)
      at org.apache.logging.log4j.core.impl.ThrowableProxy.&lt;init&gt;(ThrowableProxy.java:138)
      at org.apache.logging.log4j.core.impl.ThrowableProxy.&lt;init&gt;(ThrowableProxy.java:122)
      at org.apache.logging.log4j.core.impl.Log4jLogEvent.getThrownProxy(Log4jLogEvent.java:605)
      at org.apache.logging.log4j.core.pattern.ExtendedThrowablePatternConverter.format(ExtendedThrowablePatternConverter.java:64)
      at org.apache.logging.log4j.core.pattern.PatternFormatter.format(PatternFormatter.java:38)
      at org.apache.logging.log4j.core.layout.PatternLayout$PatternSerializer.toSerializable(PatternLayout.java:334)
      at org.apache.logging.log4j.core.layout.PatternLayout.toText(PatternLayout.java:233)
      at org.apache.logging.log4j.core.layout.PatternLayout.encode(PatternLayout.java:218)
      at org.apache.logging.log4j.core.layout.PatternLayout.encode(PatternLayout.java:58)
      at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.directEncodeEvent(AbstractOutputStreamAppender.java:177)
      at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.tryAppend(AbstractOutputStreamAppender.java:170)
      at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:161)
      at org.apache.logging.log4j.core.appender.RollingFileAppender.append(RollingFileAppender.java:309)
      at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:156)
      at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:129)
      at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:120)
      at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84)
      at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:464)
      at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:448)
      at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:431)
      at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:406)
      at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:63)
      at org.apache.logging.log4j.core.Logger.logMessage(Logger.java:146)
      at org.apache.logging.log4j.spi.AbstractLogger.tryLogMessage(AbstractLogger.java:2170)
      at org.apache.logging.log4j.spi.AbstractLogger.logMessageTrackRecursion(AbstractLogger.java:2125)
      at org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2108)
      at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:1991)
      at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1835)
      at org.apache.logging.log4j.spi.AbstractLogger.warn(AbstractLogger.java:2684)
  </code></pre>