If you have a section like this in your application.yml file:
logging:
level:
root: INFO
com.example.modules: INFO
com.com.example.utils: DEBUG
You will get duplicate entries in the log4j file output one for each layer root + package + child package ...
This is probably due to the fact that spring boot fails to turn off additivity in the underlying logger by default and does not provide any documentation on how to disable additivity within the application.properties file.
This is using slf4j logger, on Spring Boot Starter Parent 2.6.7 with all managed dependencies using the starter parent managed dependency recommendations. (no version overrides)
Comment From: wilkinsona
Thanks for the report but I'm not sure that I understand how to reproduce the problem you've described. I suspect, but can't be sure, that the problem may be caused by an external logging configuration file. If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
Comment From: steowens
So it turns out I did have a logbook.xml in the project and it wasn't setting additivity="false" on the loggers that were not root. Problem solved.
Comment From: saimounikaperi
@steowens Hi, This is my first issue in open source. Could you please help me in understanding how to reproduce this issue in my local to understand the issue.
Comment From: bclozel
@saimounikaperi this is an invalid report. There is no bug in the Spring Boot project, this was a misconfiguration in the app itself. We're closing this as a result.