Search code examples
springspring-bootspring-cloud

Application name is missing in Spring Boot logs


For example, people usually get something like this (my-service-id is the application name)

2016-02-11 17:12:45.404  INFO [my-service-id] 85184 --- [nio-8080-exec-1] com.example.MySimpleComponentMakingARequest     : ...

But I get something like

2016-02-11 17:12:45.404  INFO 85184 --- [nio-8080-exec-1] com.example.MySimpleComponentMakingARequest     : ...

What am I doing wrong ?


Solution

  • One option is to configure that via application.properties

    application.properties

    spring.application.name=stackoverflow
    logging.pattern.level= %5p [${spring.application.name}] 
    

    If want to use the project info defined in your pom.xml you could do something like:

    [email protected]@ @project.version@
    

    Full documentation can be found here: logging features