Spring Boot 日志记录器从服务帐户密钥json而不是env变量`GOOGLE_CLOUD_PROJECT`获取`projectId`

flvtvl50  于 2024-01-06  发布在  Spring
关注(0)|答案(1)|浏览(113)

我在intellij GOOGLE_CLOUD_PROJECTSPRING_CLOUD_GCP_LOGGING_PROJECT_ID中设置了这两个变量,但LoggingAppender类仍然获得了projectId null,并最终从服务帐户JSON文件中阅读。这是什么问题?
我的logback-spring.xml

  1. <configuration debug="true">
  2. <include resource="com/google/cloud/spring/logging/logback-appender.xml"/>
  3. <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
  4. <include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
  5. <root level="INFO">
  6. <appender-ref ref="STACKDRIVER"/>
  7. </root>
  8. </configuration>

字符串
依赖关系版本

  1. <properties>
  2. <java.version>1.8</java.version>
  3. <spring-cloud-gcp.version>3.7.5</spring-cloud-gcp.version>
  4. <spring-cloud.version>2021.0.9</spring-cloud.version>
  5. </properties>


在类LoggingAppender中,变量LoggingOptions.Builder loggingOptionsBuilder = LoggingOptions.newBuilder();为null。但super.getLoggingOptions()具有来自环境变量的正确记录器值。
x1c 0d1x的数据

相关问题