I would like to take some action when tomcat service is going down. For example, I would like to simply log the stop time of the tomcat service. Is there any way to do this by applying hooks to tomcat lifecycle event ? If yes, then please provide some details.
I would like to call one class when tomcat is going down and this class will log the time in some property file.
Thanks.
You have to implement interface org.apache.catalina.LifecycleListener and then register it in your tomcat configuration.. You may find how in this document in section Lifecycle Listeners.
Hope this helps you..
edit: changed URL to correct document 😉