Simplified getInstance(String) a little bit.

This commit is contained in:
hns 2005-06-09 16:34:00 +00:00
parent 04a1b2cb80
commit 2b2fdf59c1

View file

@ -64,17 +64,11 @@ public class Logging extends LogFactory {
throw new LogConfigurationException("No logname specified!"); throw new LogConfigurationException("No logname specified!");
} }
Logger log = null;
if ("console".equals(logdir)) { if ("console".equals(logdir)) {
log = consoleLog; return getConsoleLog();
} else { } else {
log = getFileLogger(logname); return getFileLog(logname);
} }
ensureRunning();
return log;
} }
/** /**
@ -82,7 +76,6 @@ public class Logging extends LogFactory {
*/ */
public static Log getConsoleLog() { public static Log getConsoleLog() {
ensureRunning(); ensureRunning();
return consoleLog; return consoleLog;
} }
@ -90,7 +83,7 @@ public class Logging extends LogFactory {
/** /**
* Get a file logger, creating it if it doesn't exist yet. * Get a file logger, creating it if it doesn't exist yet.
*/ */
private synchronized Logger getFileLogger(String logname) { public synchronized Logger getFileLog(String logname) {
Logger log = (Logger) loggerMap.get(logname); Logger log = (Logger) loggerMap.get(logname);
if (log == null) { if (log == null) {
@ -99,6 +92,7 @@ public class Logging extends LogFactory {
loggers.add(log); loggers.add(log);
} }
ensureRunning();
return log; return log;
} }