|
|
|
@ -86,8 +86,8 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected String[] getStandardConfigLocations() {
|
|
|
|
|
return new String[] { "logback-test.groovy", "logback-test.xml", "logback.groovy",
|
|
|
|
|
"logback.xml" };
|
|
|
|
|
return new String[] { "logback-test.groovy", "logback-test.xml",
|
|
|
|
|
"logback.groovy", "logback.xml" };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -110,9 +110,8 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
|
|
|
|
|
LoggerContext context = getLoggerContext();
|
|
|
|
|
stopAndReset(context);
|
|
|
|
|
LogbackConfigurator configurator = new LogbackConfigurator(context);
|
|
|
|
|
context.putProperty("LOG_LEVEL_PATTERN",
|
|
|
|
|
initializationContext.getEnvironment().resolvePlaceholders(
|
|
|
|
|
"${logging.pattern.level:${LOG_LEVEL_PATTERN:%5p}}"));
|
|
|
|
|
context.putProperty("LOG_LEVEL_PATTERN", initializationContext.getEnvironment()
|
|
|
|
|
.resolvePlaceholders("${logging.pattern.level:${LOG_LEVEL_PATTERN:%5p}}"));
|
|
|
|
|
new DefaultLogbackConfiguration(initializationContext, logFile)
|
|
|
|
|
.apply(configurator);
|
|
|
|
|
}
|
|
|
|
@ -131,8 +130,8 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
|
|
|
|
|
ResourceUtils.getURL(location));
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex) {
|
|
|
|
|
throw new IllegalStateException(
|
|
|
|
|
"Could not initialize Logback logging from " + location, ex);
|
|
|
|
|
throw new IllegalStateException("Could not initialize Logback logging from "
|
|
|
|
|
+ location, ex);
|
|
|
|
|
}
|
|
|
|
|
List<Status> statuses = loggerContext.getStatusManager().getCopyOfStatusList();
|
|
|
|
|
StringBuilder errors = new StringBuilder();
|
|
|
|
@ -143,8 +142,8 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (errors.length() > 0) {
|
|
|
|
|
throw new IllegalStateException(
|
|
|
|
|
"Logback configuration error " + "detected: \n" + errors);
|
|
|
|
|
throw new IllegalStateException("Logback configuration error "
|
|
|
|
|
+ "detected: \n" + errors);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -201,15 +200,14 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
|
|
|
|
|
|
|
|
|
|
private ch.qos.logback.classic.Logger getLogger(String name) {
|
|
|
|
|
LoggerContext factory = getLoggerContext();
|
|
|
|
|
return factory
|
|
|
|
|
.getLogger(StringUtils.isEmpty(name) ? Logger.ROOT_LOGGER_NAME : name);
|
|
|
|
|
return factory.getLogger(StringUtils.isEmpty(name) ? Logger.ROOT_LOGGER_NAME
|
|
|
|
|
: name);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private LoggerContext getLoggerContext() {
|
|
|
|
|
ILoggerFactory factory = StaticLoggerBinder.getSingleton().getLoggerFactory();
|
|
|
|
|
Assert.isInstanceOf(LoggerContext.class, factory,
|
|
|
|
|
String.format(
|
|
|
|
|
Assert.isInstanceOf(LoggerContext.class, factory, String.format(
|
|
|
|
|
"LoggerFactory is not a Logback LoggerContext but Logback is on "
|
|
|
|
|
+ "the classpath. Either remove Logback or the competing "
|
|
|
|
|
+ "implementation (%s loaded from %s). If you are using "
|
|
|
|
|