alibaba / nacos

an easy-to-use dynamic service discovery, configuration and service management platform for building cloud native applications.
https://nacos.io
Apache License 2.0
30.07k stars 12.81k forks source link

How use properties from nacos config in logback.xml ? #1782

Closed Astronaut-K closed 5 years ago

Astronaut-K commented 5 years ago

I have logback config xml in springcloud project(Using nacos config & discovery v1.1.3).Then I set some datasource properties in logback-development.xml(These properties are store in nacos). But the log appender print error that properties are null when I run application.

logback-development.xml:

<appender name="redis_out" ....
.......
  <host>${LOG_REDIS_HOST}</host>
 <port>${LOG_REDIS_PORT}</port>
......
  <pattern>
 {  "app": "${spring.application.name}",
    "timestamp": "%d{yyyy-MM-dd'T'HH:mm:ss.SSSZZ}",
......
 </appender>

The log appender print error like this : [{"app":"spring.application.name_IS_UNDEFINED",......

It seems like properties are not active when log appender init.

zyzhang15 commented 4 years ago

why close the Issue , I think it's a real problem ,Nacos and Logback not working well toghter. HaHa~~

Starbucksstar commented 4 years ago

+1,logback-spring.xml在springboot工程中遇到同样问题

lgw79674057 commented 3 years ago

+1,logback-spring.xml在springboot工程中遇到同样问题