dcsimg
Getting the size of a log file
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Dave_Watson
Posted On:   Thursday, May 24, 2001 03:07 AM

Basically, i need to write to a log file (not continuously) and when that gets to a certain size, create a new one. How can i check the size of the file? Can I do this without reading the entire content?

Re: Getting the size of a log file

Posted By:   Christopher_Schultz  
Posted On:   Thursday, May 24, 2001 06:54 AM

Check out the method java.io.File.length(). I think this will do what you want.



Alternatively, you could count the number of bytes that you write out to the log file as it's being written, and when it hits your maximum, create a new one.



-chris
About | Sitemap | Contact