Details
-
Bug
-
Resolution: Unresolved
-
Major
-
1.1.11
-
None
-
MacOS, Spring Boot 1.5.3.RELEASE, Java 8
Description
Here is my logback.xml:
<configuration scan="true" scanPeriod="10 seconds"> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"> <pattern> %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n </pattern> </encoder> </appender> <logger name="com.acme" level="DEBUG" additivity="false"> <appender-ref ref="STDOUT"/> </logger> <root level="INFO"> <appender-ref ref="STDOUT"/> </root> </configuration>
Notice that scan=true and scanPeriod=10 seconds.
I host my logback.xml file on a remote server and I use Spring Boot to instantiate logback. Spring boot takes the property -Dlogging.config=http://acme.com:1337/logback.xml and passes this to: ch.qos.logback.core.joran.GenericConfigurator#doConfigure(java.net.URL)
Logback looks up the config-file from the remote url, instantiates the config, and everything seems fine, except for autoscanning.
I see that logback uses the class ch.qos.logback.core.joran.spi.ConfigurationWatchList to keep track of files with autoscanning and a class called ch.qos.logback.classic.joran.ReconfigureOnChangeTask to do the periodic polling.
When a URI is added to the watch-list, the following code is executed:
ch.qos.logback.core.joran.spi.ConfigurationWatchList#addAsFileToWatch private void addAsFileToWatch(URL url) { File file = convertToFile(url); if (file != null) { fileWatchList.add(file); lastModifiedList.add(file.lastModified()); } } ch.qos.logback.core.joran.spi.ConfigurationWatchList#convertToFile File convertToFile(URL url) { String protocol = url.getProtocol(); if ("file".equals(protocol)) { return new File(URLDecoder.decode(url.getFile())); } else { addInfo("URL [" + url + "] is not of type file"); return null; } }
Notice that theres a check to ensure that the URL-protocol is "file". This check fails for URL's with http-protocol, so no autoscanning is performed on the configuration-file.
Is this expected behaviour? If so, why, and is it possible to create a feature-request for autoscanning on http-uri's?
Attachments
Issue Links
- relates to (in)
-
LOGBACK-1010 Cannot configure Logback autoscan in Wildfly (jboss) 8.1
- Open
- relates to (out)
-
LOGBACK-470 Strange new error message during application startup with 0.9.28
- Resolved
- links to