I dug into this issue myself . It doesn't seem that context.reset() is completely threadsafe If other threads in the system are creating loggers at the time reset() is called, this is exception may occur. The test code below reproduces this problem in Logback 1.0.13
package com.tvrc.test;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ch.qos.logback.classic.LoggerContext;
public class TestReset {
publicstatic void main(String[] args) {
// TODO Auto-generated method stub
Logger foo=LoggerFactory.getLogger("Test");
foo.info("Just checking that logging is up");
Thread logCreator=newThread(newRunnable(){
@Override
public void run() {
// TODO Auto-generated method stub
try{
List<Logger> loggers=new ArrayList<Logger>();
int counter=0;
while(true){
Logger test=LoggerFactory.getLogger("logger"+counter++);
loggers.add(test);
}
}catch(Throwable t){
t.printStackTrace();
}
}
},"logCreator");
logCreator.start();
LoggerContext context=(LoggerContext) LoggerFactory.getILoggerFactory();
try{
while (true){
context.reset();
}
}catch(Throwable t){
t.printStackTrace();
}
}
}
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
I dug into this issue myself . It doesn't seem that context.reset() is completely threadsafe If other threads in the system are creating loggers at the time reset() is called, this is exception may occur. The test code below reproduces this problem in Logback 1.0.13