- 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:
parent
23efbd457d
commit
0e2aca1c07
1 changed files with 8 additions and 19 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue