Aiming at the problem of concurrent locks in log4j 1.2.15, is it the io bottleneck or the lock competition that leads to thread block??

http://dikar.iteye.com/blog/1.

the article points out that read-write locks are used to solve the problem of thread block: I tend to use IO bottleneck as the most important factor; in addition, the practice of static one Logger per call place provided by him at the end of the article does not solve the problem of lock competition.
the content of the blog post is as follows:
often encounters thread block residence problems caused by log4j errors under high concurrency. The code snippets that often encounter problems are as follows:

Java Code

public void callAppenders(LoggingEvent event) {  
 int writes = 0;  

 for(Category c = this; c != null; c=c.parent) {  
 // Protected against simultaneous call to addAppender, removeAppender,... 
 synchronized(c) {  
 if(c.aai != null) {  
      writes += c.aai.appendLoopOnAppenders(event);  
    }  
 if(!c.additive) {  
 break;  
    }  
      }  
    }  

 if(writes == 0) {  
      repository.emitNoAppenderWarning(this);  
    }  
  }  

there will be a sync block inside, and along with this Synchronize block may cause a lock competition that makes cpu feel like a hang resident.
there is already a bug, for this problem. See https://issues.apache.org/bug.
also proposes a new solution for this bug, using rw lock.
however, this problem can still occur if you do not upgrade log4j, in the case of misuse. In view of this, colleagues put forward the best use method to avoid this problem. It is very simple that the log object needs to be static every time it is used. The white point is
Java code

.

private static final Log log = LogFactory.getLog ("xxx");
incidentally, there happens to be an article related to log4J deadlock
Log4j Thread Deadlock-A Case Study
http://java.dzone.com/article.

.
Mar.21,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3841a-4d799.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3841a-4d799.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?