Limiting the logfile size
1 posts in topic
Flat View  Flat View

Posted By:   Priti_Rajeshwari
Posted On:   Tuesday, January 8, 2002 04:58 AM

Hi all Java gurus, Need ur help. How can I limit the size of a growing logfile?
I have opened a FileOutputStream(fis) for logging the flow of control of an application which fetches db performance related data. This application is run overnight, the logfile grows to a enormous length. Is there a way to limit its size to say 300 k and keep appending the data to the end of the logfile and remove the earlier loggings from the beginning of the file...

Re: Limiting the logfile size

Posted By:   Christopher_Schultz  
Posted On:   Tuesday, January 8, 2002 05:43 AM

In general, this type of logging is hard to to (keep a 'window' of lot entries).

First, let me highly recommend log4j, which is a logging package that can support something close to what you want. It can be configured to automatically back-up your log files when they reach a certain age or size.

You can find log4j at http://jakarta.apache.org/log4j.

About | Sitemap | Contact