1

springboot 2.1.3

I set logback-spring.xml,

<springProperty scope="context" name="logPath", source="myapp.log.path" defaultValue="/home/logs/myappLog"></springProperty>
<springProperty scope="context" name="varname", source="spring.application.name" defaultValue="abc"></springProperty>

<contextName>${varname}</contextName>

application.properties

spring.application.name=myproject

I got error

Exception in thread "main" java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.classic.joran.action.ContextNameAction - Failed to rename context [abc] as [myproject] java.lang.IllegalStateException: Context has been already given a name
    at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:169)
...
...

I search some articles, springboot-with-logback-creating-log-path-is-undefined-folder, LOG_FILE_IS_UNDEFINED log file is being created in boot 1.4.5, but I did not fine the solution.

Nick Dong
  • 3,638
  • 8
  • 47
  • 84

0 Answers0