1、首先在resource目录下建立application-logger.yml文件。此处文件的命名需要满足下方条件。按照application-xxx.yml这种形式来。
在Spring Boot中多环境配置文件名必须满足:
application-{profile}.properties的固定格式,
其中{profile}对应你的环境标识
例如:
application-dev.properties:开发环境
application-test.properties:测试环境
application-prod.properties:生产环境
application.properyies通过spring.profiles.active来具体激活一个或者多个配置文件,如果没有指定任何profile的配置文件的话,spring boot默认会启动application-default.properties。
2、在文件application-logger.yml中添加下面内容(就是tomcat服务器的端口号,修改它):
3、在原有的application.properties文件中加入下方代码,
logger:是application-xxx.yml名称中的xxx
#spring.profiles.include=logger
spring.profiles.active=log