logging - Can I configure startup and shutdown logs for Spring Boot applications? -
for ability verify startup , shutdown of our spring boot applications want configure startup.log , shutdown.log capturing events bootstrap , shutdown application.
for startup to:
root webapplicationcontext: initialization completed in {x} ms
and shutdown from:
closing org.springframework.boot.context.embedded.annotationconfigembeddedwebapplicationcontext@53bd8fca: startup date [wed aug 19 09:47:10 pdt 2015]; root of context hierarchy
to end.
is container specific? (tomcat vs jetty vs undertow)
you can create event listener watches applicationreadyevent
, contextstoppedevent
, log whatever want.
@service public class foo { @eventlistener public onstartup(applicationreadyevent event) { ... } @eventlistener public onshutdown(contextstoppedevent event) { .... } }
Comments
Post a Comment