简体   繁体   中英

How to clear Tomcat logs when undeploying the application

I need to clear all my logs when I undeploy an application in Tomcat. I don't want to clear the logs every time manually.

How can I achieve this?

I don't think you will find any solution inside Tomcat.

You can either :

  • Implement a shutdown hook (see this article ) to delete the log file when context destroyed
  • Write a shell script that delete the war file/folder (in order to undeploy) and the application log.

My preference would be the shell script, since it is really easy to write, to call and, if you need it, you can undeploy without clearing the log...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM