Actually the startup banner can be printed to console OR log, not both. I don't see a valid reason for this limitation. Having a Java console completely empty is not nice but having the banner in the log can be useful (not only nice), for example, to easily note multiple startup events. Actually I have to create a custom Banner class to get this behavior.
Comment From: wilkinsona
Thanks for the suggestion. Unfortunately, I don't think we should make this change. Adding BOTH would mean that we cannot add another mode in the future as it would be unclear to which two modes BOTH applies. If you use LOG with appropriate logging configuration, the banner will appear both in the console and in the log file. If this does not meet your needs, can you please explain why?
Comment From: pnavato
Yes, configuring a console appender for SpringApplication class only is another option, but I prefer a custom Banner class (the solution I'm using actually) because it is easier to share between projects and you are sure that no other log message from SpringApplication goes to console (I want the banner only).
I understand that BOTH could become unclear in the future, even if that enum has not changed since its creation in 2015; a name like CONSOLE_AND_LOG would be clearer but also a bit ugly. Unfortunately I have no other idea.
Comment From: philwebb
Since we've not had any other requests for this, I think we should leave the enum as it is. I'd recommend using the LOG mode for your application then getting the springBootBanner bean after the ApplicationContext has been initialized. You can then do:
springBootBannerBean.printBanner(applicationContext.getEnvironment(), null, System.out)
This should print the banner on the console, albeit a bit latter than SpringApplication would do it.