spring-cloud-commons icon indicating copy to clipboard operation
spring-cloud-commons copied to clipboard

The logfile in the configuration center does not take effect for actuator

Open Max-Qiu opened this issue 3 years ago • 0 comments

This enhancement request comes from this problem

Also,This looks to be very similar to this problem with Spring Cloud Config which was closed as feedback was not provided.

  • environment
    • SpringBoot:2.6.8
    • SpringCloud:2021.0.2
    • SpringCloudAlibaba:2021.0.1.0
    • nacos:2.1.0
  • important step
    1. pom.xml add dependency spring-boot-starter-actuator
    2. modify the configuration
      • Add the following configuration to bootstrap.yml or application.yml
        logging:
          file:
            name: ./log/a.log
        
      • Add the following configuration in the nacos configuration center
        management:
          endpoints:
            web:
              exposure:
                include: "logfile" # enable log endpoint
        logging:
          file:
            name: ./log/b.log
        
    3. start server
    4. Open the log folder, Contains two files a.log and b.log, Logs are refreshed in b.log
  • issue
    • Browser open url http://[ip]:[port]/actuator/logfile,Only the file content of a.log is displayed
    • If logging.file.name is not configured in bootstrap.yml or application.yml, A 404 error code is displayed when visit the url
  • a complete yet minimal sample, include documentation

Max-Qiu avatar May 25 '22 01:05 Max-Qiu