I think there is a bug / problem in the way Spring Boot configures logging with Logback.
Using Spring Boot 2.4.8 and Spring Cloud Aws 2.31, I created a minimalist Spring Boot application with a dependency on "spring-cloud-starter-aws-parameter-store-config" using paramstore.
If I do not set any AWS credentials, the AWS SDK cannot connect, so there is an error. But Spring Boot only logs :
ERROR | org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter | report |
***************************
APPLICATION FAILED TO START
***************************
I also added a test class without Spring Boot, using Logback and a similar AWS call, and the logs contain :
DEBUG | com.amazonaws.auth.AWSCredentialsProviderChain | getCredentials | Unable to load credentials from WebIdentityTokenCredentialsProvider: To use assume role profiles the aws-java-sdk-sts module must be on the class path.
DEBUG | com.amazonaws.auth.AWSCredentialsProviderChain | getCredentials | Unable to load credentials from com.amazonaws.auth.profile.ProfileCredentialsProvider@5ce4369b: Unable to load credentials into profile [default]: AWS Access Key ID is not specified.
WARN | com.amazonaws.internal.InstanceMetadataServiceResourceFetcher | handleException | Fail to retrieve token
com.amazonaws.SdkClientException: Failed to connect to service endpoint:
So, as you can see all, those AWS logs are missing when using Spring Boot. test-spring-logging.zip
Comment From: wilkinsona
Thanks for the report and sample application. There's a chicken and egg problem here. Configuration from the environment is required to configure the logging system and code that is adding configuration to the environment is performing some logging.
To overcome this problem, Spring Boot provides a DeferredLog
class. Logging calls made to a DeferredLog
are automatically output once the environment has been prepared or the attempt to prepare it has failed. It's already used in a number of other places in Spring Cloud. Spring Cloud AWS needs to be updated to use it in a similar manner. To that end, please open a Spring Cloud AWS issue.