Report logback errors in the exception

Update LogbackLoggingSystem to include status errors in the exception
rather than using `System.err`. Also perform additional cleanup in an
attempt to fix CI build failures.

Fixes gh-3309
pull/3333/head
Phillip Webb 10 years ago
parent 7879743b9f
commit 5eb9cd012c

@ -125,21 +125,23 @@ public class LogbackLoggingSystem extends Slf4JLoggingSystem {
+ location, ex);
}
List<Status> statuses = context.getStatusManager().getCopyOfStatusList();
if (containsError(statuses)) {
for (Status status : statuses) {
System.err.println(status);
}
throw new IllegalStateException("Logback configuration error detected");
}
}
private boolean containsError(List<Status> statuses) {
StringBuilder errors = new StringBuilder();
for (Status status : statuses) {
if (status.getLevel() == Status.ERROR) {
return true;
errors.append(errors.length() > 0 ? "\n" : "");
errors.append(status.toString());
}
}
return false;
if (errors.length() > 0) {
throw new IllegalStateException("Logback configuration error "
+ "detected: \n" + errors);
}
}
@Override
public void cleanUp() {
super.cleanUp();
getLoggerContext().getStatusManager().clear();
}
@Override

Loading…
Cancel
Save