Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

ideal size of catalina.out

Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The catalina.out file size on RHEL server is reaching 1GB mark. IS it a good practice to keep the file size growing?

OR can I go ahead and delete it and then it would get automatically created next time tomcat is restarted?

Screenshot of file size below:

Master Rancher
Posts: 3922
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or you could rename it  and see if TC creates a new one.
Posts: 3182
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since you are running a Linux platform, you can use logrotate to manage Tomcat's log files.
Saloon Keeper
Posts: 22503
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
catalina.out is the redirected stdout and sterr files for Tomcat. If it's approaching 1GB, then either something is very, very wrong with Tomcat, or webapps are logging to stdout - or worse, using System.out.println/System.err.println. Webapps should not log to catalina.out, regardless of how convenient it might seem. Aside from exploding Tomcat's log file size and making it harder to find what you want, there's a potential security issue.. Not every wite likes the idea of application programmers debugging with the unrestricted assistance of system logfiles.

You can build a custom Tomcat that will log to a rotating file, but since rotation involves closing the old file and creating/writing a new one and that's not really something you can do with stdout and stderr, the vanilla distro can only rotate when Tomcat stops and restarts. Which it will do, so forcibly deleting catalina.out means throwing away potentially important log history.

If you do delete catalina.out while Tomcat is running - and I don't think that Windows file locking permits that, so let's talk Linux/Unix: In that case, the file directory entry will be erases, but Tomcat will continue writing to the deleted file, since In Unix-like systems, the directory entries are more abstract than they are in Windows. Meaning that potentially the disk could fill up and there wouldn't be any obvious reason why. Only after Tomcat was stopped would the space become avaialble. And in such a case, the reason Tomcat "stopped" miight well be that the whole OS crashed.

So try and keep extraneous chaff out of catalina.out and maybe do regularly rescheduled restarts of Tomcat. If there's that much to write about, there may be other JVM resources that need a break as well.
I've got no option but to sell you all for scientific experiments. Or a tiny ad:
the value of filler advertising in 2020
    Bookmark Topic Watch Topic
  • New Topic