DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • JMeter Plugin HTTP Simple Table Server (STS) In-Depth
  • Optimizing Database Connectivity: A Comparative Analysis of Tomcat JDBC vs. HikariCP
  • Deployment of Spring MVC App on a Local Tomcat Server
  • Java 21 Is a Major Step for Java: Non-Blocking IO and Upgraded ZGC

Trending

  • How To Build Resilient Microservices Using Circuit Breakers and Retries: A Developer’s Guide To Surviving
  • Integration Isn’t a Task — It’s an Architectural Discipline
  • Intro to RAG: Foundations of Retrieval Augmented Generation, Part 1
  • How Can Developers Drive Innovation by Combining IoT and AI?
  1. DZone
  2. Coding
  3. Languages
  4. How to Rotate Tomcat catalina.out

How to Rotate Tomcat catalina.out

Avoid a crash and failure to start in tomcat through auto rotation of catalina.out on a linux/unix machine.

By 
Vineet Manohar user avatar
Vineet Manohar
·
Mar. 25, 10 · Tutorial
Likes (11)
Comment
Save
Tweet
Share
404.1K Views

Join the DZone community and get the full member experience.

Join For Free

If catalina.out becomes 2GB in size, tomcat crashes and fails to start without any error message. To avoid this scenario you should rotate catalina.out frequently. This article describes how to setup auto rotation of catalina.out on a linux/unix machine.

How to automatically rotate catalina.out daily or when it becomes bigger than 5M

1. Create this file

/etc/logrotate.d/tomcat 

2. Copy the following contents into the above file

/var/log/tomcat/catalina.out {   copytruncate   daily   rotate 7   compress   missingok   size 5M  }  

 

About the above configuration:

  • Make sure that the path /var/log/tomcat/catalina.out above is adjusted to point to your tomcat’s catalina.out
  • daily - rotates the catalina.out daily
  • rotate – keeps at most 7 log files
  • compress – compressesthe rotated files
  • size – rotates if the size of catalina.out is bigger than 5M

You don’t need to do anything else.

How it works

  1. Every night the cron daemon runs jobs listed in the /etc/cron.daily/ directory
  2. This triggers the /etc/cron.daily/logrotate file which is generally shipped with linux installations. It runs the command “/usr/sbin/logrotate /etc/logrotate.conf“
  3. The /etc/logrotate.confincludes all scripts in the/etc/logrotate.d/ directory.
  4. This triggers the /etc/logrotate.d/tomcat file that you wrote in the previous step.

Run logrotate manually

Run the following command to run the cron job manually

/usr/sbin/logrotate /etc/logrotate.conf  

More logrotate options

To see all logrotate options on your system, see the manual:

man logrotate  

From http://www.vineetmanohar.com

Apache Tomcat

Opinions expressed by DZone contributors are their own.

Related

  • JMeter Plugin HTTP Simple Table Server (STS) In-Depth
  • Optimizing Database Connectivity: A Comparative Analysis of Tomcat JDBC vs. HikariCP
  • Deployment of Spring MVC App on a Local Tomcat Server
  • Java 21 Is a Major Step for Java: Non-Blocking IO and Upgraded ZGC

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!