Details
-
Bug
-
Resolution: Fixed
-
Critical
-
1.7.26
-
None
-
java 8
slf4j 1.7.26
-
normal
-
P2
Description
If I don't have 'logback' 'log4j'...... Implementation class
The problem lies in the method
public static ILoggerFactory getILoggerFactory()
first Thread1:
if (INITIALIZATION_STATE == UNINITIALIZED) {
init.....
}
secode Thread2:
case ONGOING_INITIALIZATION: return SUBST_FACTORY;
obtained "SUBST_FACTORY",
and obtained "SubstituteLogger"
third:
Thread1:
//init failed cache "NoClassDefFoundError"
INITIALIZATION_STATE = NOP_FALLBACK_INITIALIZATION;
The SubstituteLogger obtained by Thread2 will always output the log to the queue until the memory overflows.
// code placeholder synchronized public Logger getLogger(String name) { SubstituteLogger logger = loggers.get(name); if (logger == null) { logger = new SubstituteLogger(name, eventQueue, postInitialization); loggers.put(name, logger); } return logger; } public void info(String msg) { delegate().info(msg); } Logger delegate() { if(_delegate != null) { //_delegate== null forever return _delegate; } if(createdPostInitialization) { createdPostInitialization == false forever return NOPLogger.NOP_LOGGER; } else { return getEventRecordingLogger(); } }
Attachments
Issue Links
- links to