In application.properties file I had ~ by mistake ~ a trailing space in property logging.config That leads to an failed appication start. Such simple config error should be automatically fixed by triming trailing whitespace from value of logging.config

Related code: https://github.com/spring-projects/spring-boot/blob/master/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java

    private void initializeSystem(ConfigurableEnvironment environment, LoggingSystem system, LogFile logFile) {
        LoggingInitializationContext initializationContext = new LoggingInitializationContext(environment);
        String logConfig = environment.getProperty(CONFIG_PROPERTY);
        if (ignoreLogConfig(logConfig)) {
            system.initialize(initializationContext, null, logFile);
        }
        else {
            try {
                // --->  here some trimTrailingWhitespace(logConfig)  <---
                ResourceUtils.getURL(logConfig).openStream().close();
                system.initialize(initializationContext, logConfig, logFile);
            }
            catch (Exception ex) {
                // NOTE: We can't use the logger here to report the problem
                System.err.println("Logging system failed to initialize using configuration from '" + logConfig + "'");
                ex.printStackTrace(System.err);
                throw new IllegalStateException(ex);
            }
        }
    }

logging.config=config/logback_apiserver.xml with trailing whitespace(s)

Current Stacktrace without trim trailing whitespace:

2020-06-23 13:09:37.975  INFO [,,,] 24824 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$e6aaebb] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Logging system failed to initialize using configuration from 'config/logback.xml '
java.io.FileNotFoundException: /opt/myApplication/config/logback.xml  (No such file or directory)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
        at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:86)
        at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:184)
        at java.base/java.net.URL.openStream(URL.java:1140)
        at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:317)
        at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:288)
......

Comment From: wilkinsona

Thanks for the suggestion.

We don't want to trim whitespace everywhere (https://github.com/spring-projects/spring-boot/issues/4106) but we have trimmed it in places where we feel that we can safely do so (https://github.com/spring-projects/spring-boot/issues/15972, for example). I think it's really unlikely that a logging config file's name would deliberately have trailing whitespace so it should be safe to trim it in this case. On the other hand, the current failure shows the problem so it's hopefully quite easy to identify it and fix it at source rather than relying on Boot tidying things up. Let's see what the rest of the team thinks.