Fixed an issue on how loggers are initialized

This commit is contained in:
Isaac Parenteau
2018-09-15 16:00:51 -05:00
parent 16e8ab5eb1
commit 99894f9acd
2 changed files with 10 additions and 6 deletions

View File

@ -516,16 +516,20 @@ public class ApplicationLogger implements org.slf4j.Logger {
switch (level) {
case ALL:
case TRACE:
logger.trace(format(message, level));
break;
case DEBUG:
logger.debug(format(message, level));
break;
case INFO:
logger.info(format(message));
logger.info(format(message, level));
break;
case WARN:
logger.warn(format(message));
logger.warn(format(message, level));
break;
case ERROR:
case FATAL:
logger.error(format(message));
logger.error(format(message, level));
break;
case OFF:
default:
@ -615,7 +619,7 @@ public class ApplicationLogger implements org.slf4j.Logger {
* @param message the message to log
* @return the formatted string
*/
private String format(String message) {
return String.format("th%06d [%-5s] [%s] %s", Thread.currentThread().getId(), this.level.name(), this.name, message);
private String format(String message, LogLevel level) {
return String.format("th%06d [%-5s] [%s] %s", Thread.currentThread().getId(), level, this.name, message);
}
}

View File

@ -13,7 +13,7 @@ import java.util.stream.Collectors;
*/
public class ApplicationLoggerFactory {
private static Map<String, ApplicationLogger> loggers = new TreeMap<>();
private static LogLevel DEFAULT_LEVEL = null;
private static LogLevel DEFAULT_LEVEL = LogLevel.ALL;
private static ApplicationLoggerInitializer initializer;
/**