Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Configuration locations for Spring do not allow missing for file URLs #39

Open
jgibson opened this issue Feb 16, 2016 · 0 comments
Open

Comments

@jgibson
Copy link

jgibson commented Feb 16, 2016

When the spring configuration location is specified as a file: URL if it isn't found then it causes an error. classpath: URLs fail gracefully because Spring's ResourceUtils.getURL() throws a FileNotFoundException when the classpath URL can't be resolved. In contrast File URLs only cause that exception when they are invalid as both a URL and as a filepath (something that I was unable to do on a Mac running Java 8, perhaps windows is different).

File URLs should fail gracefully to allow the multiple configuration logic to behave properly, just like they do for classpath URLs.

Caused by: ch.qos.logback.core.joran.spi.JoranException: Could not open URL [file:/Users/foo/bar/logback.xml].
       at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
       at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:75)
       at ch.qos.logback.ext.spring.LogbackConfigurer.initLogging(Unknown Source)
       ... 94 more
Caused by: java.io.FileNotFoundException: /Users/foo/bar/logback.xml (No such file or directory)
       at java.io.FileInputStream.open0(Native Method)
       at java.io.FileInputStream.open(FileInputStream.java:195)
       at java.io.FileInputStream.<init>(FileInputStream.java:138)
       at java.io.FileInputStream.<init>(FileInputStream.java:93)
       at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:90)
       at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:188)
       at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:48)
       ... 96 more

jgibson added a commit to jgibson/logback-extensions that referenced this issue Feb 16, 2016
jgibson added a commit to jgibson/logback-extensions that referenced this issue Feb 16, 2016
jgibson added a commit to jgibson/logback-extensions that referenced this issue Feb 16, 2016
jgibson added a commit to jgibson/logback-extensions that referenced this issue Oct 29, 2016
jgibson added a commit to jgibson/logback-extensions that referenced this issue Oct 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant