Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCA 2023.0.1.3 和 2023.0.3.2 版本会导致 Spring Boot 自身日志配置失效。 #3919

Open
herodotus-ecosystem opened this issue Dec 6, 2024 · 2 comments
Labels
area/nacos spring cloud alibaba nacos kind/question stale

Comments

@herodotus-ecosystem
Copy link

Spring Boot 提供了日志的配置机制,方便灵活修改日志的显示和输出。个人的配置如下所示

spring:
  config:
    activate:
      on-profile: alibaba
    import:
      - nacos:herodotus-cloud-environment.yaml?group=${PROFILE:@profile@}
      - nacos:herodotus-cloud-platform.yaml?group=common
      - nacos:herodotus-cloud-database-${DATABASE:@database@}.yaml?group=common
      - nacos:herodotus-cloud-database.yaml?group=common
      - nacos:herodotus-cloud-redis.yaml?group=common
      - nacos:herodotus-cloud-cache.yaml?group=common
      - nacos:herodotus-cloud-rest.yaml?group=common
      - nacos:herodotus-cloud-kafka.yaml?group=common
      - nacos:herodotus-cloud-social.yaml?group=common
      - nacos:${spring.application.name}.yaml?group=service
  cloud:
    nacos:
      username: ${ALIBABA_USERNAME:@alibaba.username@}
      password: ${ALIBABA_PASSWORD:@alibaba.password@}
      config:
        namespace: ${ALIBABA_NAMESPACE:@alibaba.namespace@}
        server-addr: ${ALIBABA_CONFIG_SERVER_ADDR:@alibaba.config.server-addr@}
        file-extension: yaml
      discovery:
        namespace: ${ALIBABA_NAMESPACE:@alibaba.namespace@}
        server-addr: ${ALIBABA_DISCOVERY_SERVER_ADDR:@alibaba.discovery.server-addr@}
    sentinel:
      transport:
        port: 8719
        dashboard: ${ALIBABA_SENTINEL_SERVER_ADDR:@alibaba.sentinel.server-addr@}
#      datasource:
#        flow:
#          nacos:
#            server-addr: @alibaba.config.server-addr@
#            data-id: ${spring.application.name}-sentienl-flow.json
#            group-id: management
#            data-type: json
#            rule-type: flow

logging:
  file:
    name: logs/${spring.application.name}.log
  #  config: http://${spring.cloud.nacos.config.server-addr}/nacos/v1/cs/configs?group=logs&tenant=${spring.cloud.nacos.config.namespace}&dataId=logback-spring.xml
  #  config: http://${spring.cloud.nacos.config.server-addr}/nacos/v1/cs/configs?group=logs&dataId=logback-spring.xml
  level:
    root: info
    # 关闭不必要的日志
    org.reflections.Reflections: off
    com.alibaba.nacos.client: error
    com.alibaba.nacos.common.remote.client: error
    com.ulisesbocchio: error
    # 开发、调试需要的日志
    cn:
      herodotus: debug
    org.springframework.security: info
    org.springframework.web: debug
    com.alicp.jetcache: debug
    org.springframework.cloud.bus: info
    org.apache.kafka: off

问题

在 使用 SCA 2023.0.1.2 时,一切正常。通过在 bootstrap.yml 中 修改 logging.level.<logger-name>=<level> 就可以控制日志的输出和显示。

例如:将 org.springframework.security: info 修改为 org.springframework.security: debug 就会显示更多日志信息。

将 SCA 升级至 2023.0.1.3 或者 2023.0.3.2 以后, Spring Boot 的日志配置就完全失效。不管怎么修改 logging.level.<logger-name>=<level> ,都无法改变日志的显示内容。

仅在修改 logging.level.root 值时,会显示不同级别的 Nacos 的相关的日志

@martinchen911
Copy link

+1

Copy link

github-actions bot commented Jan 9, 2025

This issue has been open 30 days with no activity. This will be closed in 7 days.

@github-actions github-actions bot added the stale label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/nacos spring cloud alibaba nacos kind/question stale
Projects
None yet
Development

No branches or pull requests

3 participants