I would like to include some spring properties in my logback.xml pattern, but until I know it is not possible due to application.properties is loaded after logback.xml
There is a way to include a property from application.properties or from project pom.xml?
This is my logback code:
%d{"yyyy-MM-dd HH:mm:ss,SSSZ"} [%p] %c ${project.artifactId} - %msg%n
There is a dedicated property called springProperty
which you can use in your Logback configuration file.
<configuration>
<springProperty name="artifactId" source="project.artifactId"/>
...
<fileNamePattern> ... ${artifactId} ... </fileNamePattern>
...
</configuration>
The source
attribute should match the key in your application.properties. The name
attribute is used to refer the value inside the configuration.