EvilJinious1 EvilJinious1 - 1 month ago 24
Java Question

adding a custom logback log pattern in spring boot yml file

I have been looking all over and was not able to figure this out. I need to add a custom log pattern for log output. I can do this very easily through a logback.xml file in the resources directory and it works exactly as I want it.

However, I would like to be able to do this throughout he application.yml file if that is possible. Mostly because I would like to externalize it in one place.

I have the normal logging stuff in application.yml as below:

#logging definitions


use the hierarchy tree to set logging levels



logging:
file: logs/accountservice.log
level:
org:
springframework: 'INFO'
com:
mangofactory:
swagger:
scanners: 'OFF'
cisco:
services: 'DEBUG'

The log pattern is like this:

Answer

As of Spring Boot 1.2 it's not possible to customize the pattern using application.yml. There is a feature request open to improve this (https://github.com/spring-projects/spring-boot/issues/1788).

Comments