Search code examples
springspring-bootlogginglogback

How to clean up logs printed by spring , i am using logback.xml


I am new to spring boot.I want to remove below logs by spring framework, which is printing by default when ever my spring boot application shutdown.

I am using logback.xml for logging.

2018-07-02 21:56:11.623 [main] INFO  o.s.c.a.AnnotationConfigApplicationContext - Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@14514713: startup date [Mon Jul 02 21:55:43 UTC 2018]; root of context hierarchy
2018-07-02 21:56:11.624 [main] INFO  o.s.j.e.a.AnnotationMBeanExporter - Unregistering JMX-exposed beans on shutdown

I tried by putting below entry in logback.xml file but it didn't work.

<logger name="org.springframework.boot" level="off" additivity="false">
    <appender-ref ref="FILE" />
</logger>

Solution

  • If you want to disable log for all Spring classes use the following.

    <logger name="org.springframework" level="off"/>
    

    You don't need to mention appender-ref since it won't be printed.