无法通过 com.springframework.context 的 Spring 应用程序配置关闭日志记录

问题描述

我想减少我使用的特定配置文件 @H_502_1@local 的日志记录。

我发现要设置这些属性

@H_502_1@logging:
  level:
    org:
      springframework:
        web: ERROR
        context: ERROR

我使用 @H_502_1@local 配置文件启动我的应用程序。 运行时,我希望以下语句消失:

@H_502_1@2021-01-18 09:08:51,826 INFO  [main] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker: Bean 'org.springframework.hateoas.config.HateoasConfiguration' of type [org.springframework.hateoas.config.HateoasConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-01-18 09:08:51,829 INFO  [main] org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker: Bean 'relProviderPluginRegistry' of type [org.springframework.plugin.core.support.PluginRegistryfactorybean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)

但是它们仍在渲染中。我设置为 @H_502_1@debug 的其他日志级别成功呈现 @H_502_1@DEBUG 语句。但在这种情况下,我希望语句消失它不起作用。

详情

这是我的完整 @H_502[email protected] 文件

@H_502_1@spring:
  profiles:
    active: cloud
  datasource:
    url: jdbc:MysqL:///prototype?cloudsqlInstance=${sql_CONNECTION}&socketFactory=com.google.cloud.sql.MysqL.socketFactory&user=${sql_USER:root}&password=${sql_PASSWORD:root}
    hikari:
      maximum-pool-size: 4
server:
  port: ${PORT:8080}
---
spring:
  profiles:
    active: local
  datasource:
    url: jdbc:MysqL://${sql_CONNECTION:localhost}:3306/prototype?useSSL=false&allowPublicKeyRetrieval=true
    username: root
    password: root
    hikari:
      maximum-pool-size: 4
  jpa:
    hibernate:
      ddl-auto: update
    generate-ddl: true

server:
  port: 8080

logging:
  level:
    org:
      springframework:
        web: ERROR
        context: ERROR

---
spring:
  profiles:
    active: debug

logging:
  level:
    com:
      google:
        cloud:
          sql: DEBUG
    org:
      springframework:
        boot:
          autoconfigure:
            jdbc: DEBUG
        web: DEBUG
        context: DEBUG
      hibernate: DEBUG

我的@H_502[email protected]

@H_502_1@<configuration>
    <springProfile name="!cloud,debug">
        <appender name="CONSOLE"
                  class="ch.qos.logback.core.ConsoleAppender">
            <layout class="ch.qos.logback.classic.PatternLayout">
                <Pattern>
                    %black(%d{ISO8601}) %highlight(%-5level) [%blue(%t)] %yellow(%C{1.}): %msg%n%throwable
                </Pattern>
            </layout>
        </appender>
        <root level="info">
            <appender-ref ref="CONSOLE" />
        </root>
    </springProfile>
    <springProfile name="cloud">
        <appender name="CLOUD" class="com.google.cloud.logging.logback.LoggingAppender"/>
        <root level="info">
            <appender-ref ref="CLOUD" />
        </root>
    </springProfile>
</configuration>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)