java - Share Spring Boot YAML configuration between two applications -
i have 2 applications in same maven project , have given each of them own configuration file setting spring.config.name
property each before invoking springapplication.run().
this in first application, set spring.config.name
server1
looks server1
instead of application.yml
. in second have set spring.config.name
server2
.
however them share same logging configuration. unfortunately, logging configuration cannot imported via @propertysource since logging configured before property-sources read - see logging section of spring boot manual.
is there way can this?
spring boot uses default logback. can put logback.xml file in src/main/resources configure log. , both applications automatically use file configure logging engine.
you can learn how configure logback here: http://logback.qos.ch/manual/configuration.html
a simple example. set log level info , log console:
<configuration> <appender name="stdout" class="ch.qos.logback.core.consoleappender"> <encoder> <pattern>%d{hh:mm:ss.sss} [%thread] %-5level %logger{36} - %msg%n</pattern> </encoder> </appender> <root level="info"> <appender-ref ref="stdout" /> </root> </configuration>
Comments
Post a Comment