Attaching sample test program for simulated multithreading logging.

From: Pooja Pandey <pooja.pan...@asg.com.INVALID>
Sent: Friday, March 25, 2022 4:37 AM
To: Log4J Users List <log4j-user@logging.apache.org>
Subject: Synchronization issue in multithreading (Losing huge data in 
multithreading) with log4j 1.x bridge (2.17.2)

*** External email: Verify sender before opening attachments or links ***

Hi,

In our application we have migrated from log4j1.x to log4j1.x bridge. With 
Log4j1.x there was no issue with multithreading but with log4j 1.x bridge we 
have noticed that in multithreading environment there is a huge data loss while 
logging, however single thread works fine. I see that in Category.java which 
Logger extends; many methods are not synchronized any more in log4j1.x bridge 
however which were in case of log4j1.x. I suspect this could be root cause of 
this multithreading problem. Please let me know if you have any idea.

I have compared Category.java which is a kind of core class for logging 
functionality in Log4j1.x and Log4j1.x bridge and I see that many methods which 
we are using were synchronized in log4j1.x but NOT in log4j1.x bridge. I think 
this could be one of the root causes leading to this problem.

[cid:image001.png@01D84001.E6BD9A00]

Log4j1.x:   synchronized public Appender getAppender(String name)
Log4j1.x bridge:     public Appender getAppender(final String name)

[cid:image002.png@01D84001.E6BD9A00]
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to