I have placed logback-spring.xml together with application.yaml in centralised git repository. I have successfully configured config server and config client for retrieval of application.yaml. I have also verified that config server is serving logback-spring.xml through the plain text API.
Question: how can I configure config client to retrieve the logback-spring.xml via config server?
I tried with logging.config=http://config.example.com/appA/prod/develop/logback-spring.xml and it worked. But this is plain spring boot functionality. When I modified logback-spring.xml in git repository, it did not refresh automatically at config client, which I really want to. In the same way as for application.yaml.
Comment From: ismarslomic
Related to my question is the autoscan functionality in logback. See this JIRA issue: https://jira.qos.ch/browse/LOGBACK-1309
Comment From: belon
Would be also good to have possibility to use config discovery service-id to locate config server not only domain.
Comment From: spencergibb
@belon your comment is unrelated to this issue and already a feature http://cloud.spring.io/spring-cloud-static/Dalston.SR1/#discovery-first-bootstrap
Comment From: spencergibb
@ismarslomic there is no functionality to do as you described.
Comment From: shouwangqing
do you solve this problem now?
Comment From: shouwangqing
Have you solved this problem now?
I have face to same problem and find no way to solve it.
I try to use the spring.cloud.config.name to specify the logback-spring.xml’ name, but it does not worked,
and it occurs a problem that
java.lang.IllegalStateException: Failed to load property source from location 'file:/D:/others/test/configBack/qing-cloud-m1-config/logback-spring.xml'
Caused by: java.util.InvalidPropertiesFormatException: org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 16; 文档根元素 "configuration" 必须匹配 DOCTYPE 根 "null"。
at sun.util.xml.PlatformXmlPropertiesProvider.load(PlatformXmlPropertiesProvider.java:80)
at java.util.Properties$XmlSupport.load(Properties.java:1201)
at java.util.Properties.loadFromXML(Properties.java:881)
at org.springframework.core.io.support.PropertiesLoaderUtils.fillProperties(PropertiesLoaderUtils.java:136)
at org.springframework.core.io.support.PropertiesLoaderUtils.loadProperties(PropertiesLoaderUtils.java:121)
at org.springframework.boot.env.PropertiesPropertySourceLoader.load(PropertiesPropertySourceLoader.java:44)
at org.springframework.boot.env.PropertySourcesLoader.load(PropertySourcesLoader.java:128)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.doLoadIntoGroup(ConfigFileApplicationListener.java:490)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadIntoGroup(ConfigFileApplicationListener.java:473)
... 87 common frames omitted
this is my config-client's bootstrap.yml
#config
spring.cloud.config.name=qing-cloud-m1-config-client,logback-spring
spring.cloud.config.profile=default
spring.cloud.config.label=master
#spring.cloud.config.uri=http://myConfigServer.com:8095/
#开通服务名来访问config-server
spring.cloud.config.discovery.enabled=true
#config-server的服务名
spring.cloud.config.discovery.service-id=qing-cloud-m1-config-server
#log
#logging.config=http://localhost:8095/*/default/master/logback-spring.xml
eureka.client.serviceUrl.defaultZone=http://admin:admin@localhost:7001/eureka/
this is my logback-spring.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<property name="ENCODER_PATTERN" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{25} %M %L - %msg%n" />
<springProperty scope="context" name="LOG-NAME" source="spring.application.name" />
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${ENCODER_PATTERN}</pattern>
</encoder>
</appender>
<appender name="FILE-APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>../../log/${LOG-NAME}.%d{yyyy-MM-dd}.log</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>${ENCODER_PATTERN}</pattern>
</encoder>
</appender>
<logger name="cn.jz" additivity="false" level="DEBUG">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE-APPENDER"/>
</logger>
<root level="DEBUG">
<appender-ref ref="CONSOLE" />
</root>
</configuration>
Comment From: marcingrzejszczak
Is it still a problem with Finchley.RELEASE?
Comment From: spencergibb
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
Comment From: juniormazella-zz
Is it still a problem with Finchley.RELEASE?
Yes