Since no one answered my question,
This link somehow helps me solve my problem.
Log4j sequentially writes files and the console. therefore, while one thread is writing another thread, which wants to write, must wait until the other is complete. In addition, stdout can block if everything attached to it at the other end does not drain it.
unix has a special file descriptor called stdout . when launching applications on the console, stdout will be attached to the console. you can also redirect stdout to other files. ex: java Blah > /dev/null . perhaps you have stdout pointing to the file to be populated. for example, a pipe is a file, and if the program on the other end does not drain the tube, then the program that writes to the pipe is ultimately blocked.
source share