|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2019 the original author or authors. |
| 2 | + * Copyright 2012-2020 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
16 | 16 |
|
17 | 17 | package org.springframework.boot.context.logging;
|
18 | 18 |
|
| 19 | +import java.io.FileNotFoundException; |
19 | 20 | import java.util.Collections;
|
20 | 21 | import java.util.List;
|
21 | 22 | import java.util.Map;
|
|
53 | 54 | import org.springframework.core.log.LogMessage;
|
54 | 55 | import org.springframework.util.LinkedMultiValueMap;
|
55 | 56 | import org.springframework.util.MultiValueMap;
|
56 |
| -import org.springframework.util.ResourceUtils; |
57 | 57 | import org.springframework.util.StringUtils;
|
58 | 58 |
|
59 | 59 | /**
|
@@ -314,13 +314,17 @@ private void initializeSystem(ConfigurableEnvironment environment, LoggingSystem
|
314 | 314 | }
|
315 | 315 | else {
|
316 | 316 | try {
|
317 |
| - ResourceUtils.getURL(logConfig).openStream().close(); |
318 | 317 | system.initialize(initializationContext, logConfig, logFile);
|
319 | 318 | }
|
320 | 319 | catch (Exception ex) {
|
| 320 | + Throwable exceptionToReport = ex; |
| 321 | + while (exceptionToReport != null && !(exceptionToReport instanceof FileNotFoundException)) { |
| 322 | + exceptionToReport = exceptionToReport.getCause(); |
| 323 | + } |
| 324 | + exceptionToReport = (exceptionToReport != null) ? exceptionToReport : ex; |
321 | 325 | // NOTE: We can't use the logger here to report the problem
|
322 | 326 | System.err.println("Logging system failed to initialize using configuration from '" + logConfig + "'");
|
323 |
| - ex.printStackTrace(System.err); |
| 327 | + exceptionToReport.printStackTrace(System.err); |
324 | 328 | throw new IllegalStateException(ex);
|
325 | 329 | }
|
326 | 330 | }
|
|
0 commit comments