- Remove old debug thread dump in getInstance(String)

- Remove double checking to avoid entering synchronized code in getInstance(String)
- Rename newLog(String) to getFileLogger(String) and clean it up a little bit
This commit is contained in:
hns 2005-06-09 11:46:12 +00:00
parent 23efbd457d
commit 0e2aca1c07

View file

@ -63,18 +63,13 @@ public class Logging extends LogFactory {
if (logname == null) {
throw new LogConfigurationException("No logname specified!");
}
if ("event".equals(logname))
Thread.dumpStack();
Logger log = null;
if ("console".equals(logdir)) {
log = consoleLog;
} else {
log = (Logger) loggerMap.get(logname);
if (log == null) {
log = newLog(logname);
}
log = getFileLogger(logname);
}
ensureRunning();
@ -93,23 +88,17 @@ public class Logging extends LogFactory {
/**
* Add a log to the list of logs and
* create and start the runner thread if necessary.
* Get a file logger, creating it if it doesn't exist yet.
*/
private synchronized Logger newLog(String logname) {
// check loggerMap again because only now we are synchronized,
// so another thread may have created a log in the meantime.
private synchronized Logger getFileLogger(String logname) {
Logger log = (Logger) loggerMap.get(logname);
if (log != null) {
return log;
if (log == null) {
log = new FileLogger(logdir, logname);
loggerMap.put(logname, log);
loggers.add(log);
}
log = new FileLogger(logdir, logname);
loggerMap.put(logname, log);
loggers.add(log);
return log;
}