1

logback is unable to evaluate spring application name

<property scope="context" name="app_name" value="${spring.application.name}" /> log output:"app_name":"spring.application.name_IS_UNDEFINED"

if the property is printed out of the application context, it is working fine.

logback-classic 1.11 logback-core 1.11 logstash-logback-encoder 4.11

UPDATE: changing logback.xml to logback-spring.xml and adding <springProperty scope="context" name="app_name" source="spring.application.name" />

rather than <property scope="context" name="app_name" value="${spring.application.name}" /> fixed the issue with spring-boot 1.5.4

Thanks

kiran reddy
  • 135
  • 17

1 Answers1

1

UPDATE: changing logback.xml to logback-spring.xml and adding

rather than fixed the issue with spring-boot 1.5.4

kiran reddy
  • 135
  • 17
  • In Spring Boot 2.5.5 when I set in logback-spring.xml: I get "default" String as app_name, not the value of spring.application.name property from application.properties. Do you know how to resolve it? – Krzysztof Oct 12 '21 at 15:05