spring-cloud / spring-cloud-vault

Configuration Integration with HashiCorp Vault
http://cloud.spring.io/spring-cloud-vault/
Apache License 2.0
274 stars 152 forks source link

LeaseAwareVaultPropertySource no longer logs INFO messages during ConfigData bootstrap #565

Closed Asky-GH closed 3 years ago

Asky-GH commented 3 years ago

After migrating to spring-boot-starter-parent 2.4.2 and spring-cloud-vault-config/spring-cloud-starter-vault-config 3.0.0 LeaseAwareVaultPropertySource no longer logs INFO messages if I intentionally add some non-existing Vault path to spring.config.import. I wanted to ask if it's by design or it's a bug.

mp911de commented 3 years ago

If you would like us to spend some time helping you to diagnose the problem, please spend some time describing it and, ideally, providing a minimal sample that reproduces the problem.

Asky-GH commented 3 years ago

legacy.zip modern.zip Here are examples. The problem is that when using legacy approach I can see the following message in the console output: 2021-01-20 18:14:25.281 INFO 21488 --- [ main] o.s.v.c.e.LeaseAwareVaultPropertySource : Vault location [secret/app/some-vault-path-with-a-typo] not resolvable: Not found But with the modern approach, such a useful message is absent.

mp911de commented 3 years ago

Thanks a lot. The issue is caused by the logging config not being configured yet at the time the Vault interaction is happening. You can use for now spring.cloud.vault.fail-fast=true to get feedback from the app if the startup of a Vault component fails.

Asky-GH commented 3 years ago

Thanks a lot. The issue is caused by the logging config not being configured yet at the time the Vault interaction is happening. You can use for now spring.cloud.vault.fail-fast=true to get feedback from the app if the startup of a Vault component fails.

spring.cloud.vault.fail-fast=true is already being used but it doesn't provide any useful feedback.

mp911de commented 3 years ago

As it looks right now, the lifecycle is controlled from Spring Boot and we don't have any means to do anything useful here. It would make sense to follow up in https://github.com/spring-projects/spring-boot/issues.

mp911de commented 3 years ago

After consulting with the Boot Team, we could work around the logging issue by obtaining a specific logger that captures startup logs and prints these later on.

wilkinsona commented 3 years ago

I've opened an issue to help with this on the Boot side: https://github.com/spring-projects/spring-boot/issues/24988. I think that's a prerequisite to fixing this as you need a DeferredLogFactory, not just a Log that is deferred.

mp911de commented 3 years ago

Depends on spring-projects/spring-vault#636.