0

As per this guidelines, one has to specify application name in bootstrap.properties if using custom logback.xml. I was wondering if there's any way where I can hardcode the application name in logback.xml instead of creating the bootstrap.properties file with that property ?

I have bootstrap.properties with property spring.application.name and slueth recognizes that and things are fine. But I was wondering if there's any way where I can specify any logback property and sleuth will pick the application name up!?

Please note I am using my own custom logging format. Following is how my logback.xml file looks like.

<?xml version="1.0" encoding="UTF-8"?>
 <configuration>
   <include resource="org/springframework/boot/logging/logback/defaults.xml" />
   <property name="CONSOLE_LOG_PATTERN" value="%date{ISO8601} 
    ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } [%15.15t] %-40.40logger{39} : 
    %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>

 <root level="INFO">
    <appender-ref ref="CONSOLE" />
 </root>
</configuration>

1 Answers1

0

The <springProperty> tag lets you expose properties from the Spring Environment for use within Logback.

i.e.

<springProperty scope="context" name="fluentHost" source="myapp.fluentd.host" defaultValue="localhost"/>
IMParasharG
  • 1,869
  • 1
  • 15
  • 26
  • Thanks for the tip, however I had tried it and it still doesn't take the default value specified in the spring property. Following is what I have as a spring-property and I removed the bootstrap properties, no luck. `` – Chintan Barad Jan 02 '19 at 14:15