TomcatExpert

How to configure log rotation in Apache Tomcat 5.5 and 6.0 using the Juli logging package

posted by SpringSource on March 18, 2010 11:46 PM

How to enable file rotation to periodically purge older log files and clear space using the default juli internal logging for Apache Tomcat.

By default, Apache Tomcat dies its internal logging through juli. The quantity of information stored in the log files on any server can quickly grow to be quite large. For instance, the access log file typically grows 1 MB or more per 10,000 requests. Therefore, it may be necessary to periodically rotate the log files by moving the files or deleting the existing logs to free up space on the server and allow for more efficient searching through logs. This cannot be done while the server is running, because Apache Tomcat will continue writing to the old log file as long as it holds the file open.

 To achieve this, in the logging.properties, add: 

.handlers = 1catalina.java.util.logging.FileHandler 
.level=FINE 
 
1catalina.java.util.logging.FileHandler.level = FINE 
1catalina.java.util.logging.FileHandler.pattern = ${catalina.base}/logs/${catalina.appserver.instance}.%g.log 
1catalina.java.util.logging.FileHandler.limit = 2000000 
1catalina.java.util.logging.FileHandler.count = 5 
1catalina.java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter

where 1catalina.java.util.logging.FileHandler would instantiate the FileHandler that comes with JDK.

Since java.util.logging.FileHandler does not have .prefix or .directory, .prefix and .directory needs to be set in the catalina package:

1catalina.java.util.logging.FileHandler.pattern = ${catalina.base}/logs/catalina.%g.log 

NOTE: The names have to be consistent everywhere, including in the handlers and .handlers references.

For further details, the JDK filehandler is documented at: http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/FileHandler.html

For more than 10 years, SpringSource employees have been supporting Apache technologies, with unparalleled experience and commitment to the Apache Software Foundation. More than 400 of the Fortune 500 count on SpringSource to support their mission-critical business applications. Leaders of the Apache Software Foundation, including Board Members, work at SpringSource and dedicate a significant amount of time further developing the Apache Tomcat open source project. Over the last 2 years, 95% of the issues fixed in the Apache Tomcat project were fixed by SpringSource engineers. For more information on how SpringSource can help your enterprise, see the SpringSource website, or call 800/444-1935.

Comments

The "<handlers></handlers>"

The "<handlers></handlers>" seems confusing. Perhaps using the normal comment syntax is more appropriate:

####
# Define custom logging handlers
####

Thanks

Thanks for spotting that. Looks like a copy/paste error. I've fixed the logging.properties extract by removing those tags.

This is just another reason

This is just another reason why I like your work the best. Man, your work is sublime! You are always providing us with great, helpful informative articles. It's always a joy to read your articles. I hope you'll keep this good work going on! payday loans for bad credit in canada

obat stroke paling manjur

Obat Alami Ambeien Paling Tepat Untuk Diminum
Cara Mencegah Menggunakan amazon Plus Alami Obat Tradisional Wasir. Cara penyembuhan terbaik guna pencegahan ambeien dengan menjaga tinja tetap elastis agar bisa keluar dengan gampang, sehingga mengurangi tekanan & tegangan pada anus, selesaikan secepat mungkin setelah ada rangsangan buang air besar obat ambeien.

Stroke Dipulihkan, Badanpun fit berkat Obat Tradisional amazon
Jus Kulit Manggis Obat Alami Stroke dipercaya sudah banyak mengobati pasien storke yang mungkin sudah puluhan tahun dideritanya. Banyak cara lainnya untuk terhindar dari serangan penyakit stroke selain menggunakan Jus Kulit Manggis Obat Stroke, yaitu kegemukan, kolesterol tinggi, makanan kecil, serta mulailah lebih banyak makan buah-buahan, padi-padian dan makan makanan berserat tinggi lainnya serta ikan obat stroke paling manjur.

Solusi terbaru dan pertama di Asia Tenggara yang merupakan salah satu karya asli anak bangsa, yaitu obat Obat Tradisional Alami Penyakit Gondok “Jus Kulit Manggis”.
amazon Plus yaitu jawaban yang paling aman untuk mengatasi penyakit gondok, rasanya yang lezat & terjamin selama fase pengobatan bebas ada efek samping obat gondokan.

sl786982

Very true and inspiring article. I strongly believe all your points. I also learned a lot from your post. Cheers and thank you for the clear path. Chinese medicine clinic

sl786982

sl786982

Really a great addition. I have read this marvelous post. Thanks for sharing information about it. I really like that. Clinic online

sl786982

It is imperative that we read

It is imperative that we read blog post very carefully. I am already done it and find that this post is really amazing.
Emus4U Download

sdsd

This is a great post. I like this topic.This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting this again.
montana personal injury attorney

Great Article it its really

Great Article it its really informative and innovative keep us posted with new updates. its was really valuable. thanks a lot.
Inverter Generator

Wow what a Great Information

Wow what a Great Information about World Day its very nice informative post. thanks for the post.
Same Day Printing Leeds

Excellent article. Very

Excellent article. Very interesting to read. I really love to read such a nice article. Thanks! keep rocking.
lipo 6 black

I read that Post and got it

I read that Post and got it fine and informative.
TutuApp

Thanks for the blog loaded

Please share more like that.
black mens style

sdsdssdsdsd

It’s appropriate time to make some plans for the future and it is time to be happy. I have read this post and if I could I wish to suggest you few interesting things or advice. Perhaps you could write next articles referring to this article. I desire to read even more things about it!
Office Cleaning

These are some great tools

These are some great tools that i definitely use for SEO work. This is a great list to use in the future..
Real life stories

DANI

I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business.

I'm glad I found this web site, I couldn't find any knowledge on this matter prior to.Also operate a site and if you are ever interested in doing some visitor writing for me if possible feel free to let me know, i am always look for people to check out my web site.

The post is written in very a good manner and it contains many useful information for me.
Language of Lust

sdsds

If more people that write articles really concerned themselves with writing great content like you. more readers would be interested in their writings. Thank you for caring about your content.
Lithonia towing

sddssd

Best work you have done. this online website is really cool with great facts.
visit site

DANI

Wow what a Great Information about World Day its very nice informative post. thanks for the post.
google snack pack

prince U.S

This is a great inspiring article.I am pretty much pleased with your good work.You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post.
synthetic grass

Nice post! This is a very

Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post.
Mesavirre Bacolod

I am happy to find this post

I am happy to find this post Very useful for me, as it contains lot of information. I Always prefer to read The Quality and glad I found this thing in you post. Thanks
Friv games

An fascinating discussion is

An fascinating discussion is value comment. I think that it is best to write extra on this matter, it won’t be a taboo topic however generally people are not enough to talk on such topics. To the next. Cheers
office supplies

DANI

this is really nice to read..informative post is very good to read..thanks a lot!
property management franchise

Great article with excellent

Great article with excellent idea!Thank you for such a valuable article. I really appreciate for this great information..
instant likes

Your blog provided us with

Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging..
small business website

Farhan

Thanks for sharing the post.. parents are worlds best person in each lives of individual..they need or must succeed to sustain needs of the family
hide wp login url
.

DANI

Someone Sometimes with visits your blog regularly and recommended it in my experience to read as well. The way of writing is excellent and also the content is top-notch. Thanks for that insight you provide the readers!
life insurance

DANI

Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include.
app builder

sdsds

Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post.
Gamerbolt.com

DANI

Great post, you have pointed out some excellent points, I as well believe this is a very superb website.
Fahrschule Stuttgart

dsdsd

This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!.
GoldenSlot

prince U.S

i read a lot of stuff and i found that the way of writing to clearifing that exactly want to say was very good so i am impressed and ilike to come again in future..
James

DANI

Positive site, where did u come up with the information on this posting? I'm pleased I discovered it though, ill be checking back soon to find out what additional posts you include.
menu rating

DANI

I read your blog frequently and I just thought I’d say keep up the amazing work!
NY Design Week

This was a really great

This was a really great contest and hopefully I can attend the next one. It was alot of fun and I really enjoyed myself..
atl transportation

DANI

It is imperative that we read blog post very carefully. I am already done it and find that this post is really amazing.
Mactan Newtown condos for sale

DANIz

Your website is really cool and this is a great inspiring article.

href='https://razorzhub.com/'>does shaving help acne

This was a really great

This was a really great contest and hopefully I can attend the next one. It was alot of fun and I really enjoyed myself..
acupuncture ehr

I was reading your article

I was reading your article and wondered if you had considered creating an ebook on this subject. Your writing would sell it fast. You have a lot of writing talent.
keto diet delivery

DANI

I read a article under the same title some time ago, but this articles quality is much, much better. How you do this..
Newcastle

Thank you for such a well

Thank you for such a well written article. It’s full of insightful information and entertaining descriptions. Your point of view is the best among many.
czekolada na urodziny

Its a great pleasure reading

Its a great pleasure reading your post.Its full of information I am looking for and I love to post a comment that "The content of your post is awesome" Great work.
huggies

dsdds

Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post.
clients

Your blog provided us with

Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging..
best digital blood pressure monitor

DANI

I admire this article for the well-researched content and excellent wording. I got so involved in this material that I couldn’t stop reading. I am impressed with your work and skill. Thank you so much.
china sourcing agency

You completed a few fine

You completed a few fine points there. I did a search on the subject and found nearly all persons will go along with with your blog.
Best shampoo for hair loss

I found that site very

I found your this post while searching for some related information on blog search...Its a good post..keep posting and update the information.
WebsiteHosting.com

fdfd

Thanks for sharing the post.. parents are worlds best person in each lives of individual..they need or must succeed to sustain needs of the family.
Dht Blocking Shampoo

A debt of gratitude is in

A debt of gratitude is in order for the blog entry mate! Keep them coming... hotel escort amsterdam

Post new comment

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.