I have my logback-spring.xml as follows:
${loki_url}
As you can see I'm loading the application name and the url from my application.yml, both variables are correct, but the appender is being processed before the value is set and this error is thrown:
WARN in com.github.loki4j.logback.Loki4jAppender[LOKI] - No message layout specified in the config. Using PatternLayout with default settings
Logging system failed to initialize using configuration from 'null'
java.lang.IllegalStateException: Could not initialize Logback logging from classpath:logback-spring.xml
Caused by: java.lang.IllegalArgumentException: URI with undefined scheme
If I set with the hard-coded url, it works and I can see the entries in Loki, and also if I put ${loki_url} as part of the CONSOLE_LOG_PATTERN, in my console the url is shown correctly.
How should I declare the url to be taken from a springProperty? is there a way to reload the appender if the variable changes and ignore errors?