muthukumar
muthukumar

Reputation: 2243

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?

Upvotes: 0

Views: 514

Answers (1)

tibo
tibo

Reputation: 5494

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...

Upvotes: 3

Related Questions