Logback cannot recognize variable substitution for scanPeriod properties

I am trying to use variable substitution for the scanPeriod property scanPeriod that I can have multiple environment files.

It seems that Logback cannot recognize variable substitution for certain properties.

For example, the scanPeriod property:

Log Configuration:

 <configuration scan="${scan:-true}" scanPeriod="${scan-interval:-10 minutes}"> 

Indicated that the default value of 10 minutes is not valid.

Log Properties:

 scan=true scan-interval=30 seconds 

This property should override the default configuration of 10 minutes.

Log Error:

 java.lang.IllegalArgumentException: String value [${scan-interval:-10 minutes}] is not in the expected format. 

According to the duration API, the duration format is correct.

This is used:

  • slf4j 1.6.2
  • logback classis 0.9.30
  • logback core 0.9.30

EDIT: Filed the Jir report for this - http://jira.qos.ch/browse/LBCLASSIC-307

UPDATE: December 28, 2011 This is marked as a major, and looked at Ceki Gulcu .: D

UPDATE: June 12, 2012 There are still no updates. Leave a comment in JIRA.

UPDATE: July 12, 2012 Accepted as a valid error. Fix in 1.0.7

+6
source share
2 answers

http://jira.qos.ch/browse/LOGBACK-396

Accepted as a valid bug and will be fixed in 1.0.7

0
source

According to the duration API you posted, you can also use (without a space):

 <configuration scan="${scan:-true}" scanPeriod="${scan-interval:-10minutes}"> private static final Pattern DURATION_PATTERN = Pattern.compile(DOUBLE_PART + "\\s*" + UNIT_PART, Pattern.CASE_INSENSITIVE); 
+2
source

Source: https://habr.com/ru/post/901368/


All Articles