Following is the code I wrote. I have a simple requirement. I need to update a log file (txt file) everyday. For which, I initally take a file.. and append it with some text. once it reaches a certain size. I rename that file and append it with todays date. However, since the file may reach the specified size at any given point. I take the length of the file and append to the file name.. and decrement the length. As of now, It is making only Two files. One the main file.. and second the renamed file. The problem is for some reason the length gets stuck at 49. Then I realise it is because the first file is being checked every time(I check for the size). Could some body please tell me how I could correct this code :
Yes there is a reason I cant use log4j for this. Because AFAIK log4j doesnt give me any other logging level other than the defaults ( debug,info,...,fatal). Where as this code, I will modify and have a static method being called in my DAOs with params to append to this file.
I specifically need to be able to add the logs for updates or deletes, so I have to write statements in my DAOs.Is there a simple way I can include *this* functionality using Log4j, curently am using it for logging application related stuff. I have done a lot of googling for this.. but they are way too complex for me to follow. I am crushed under deadlines . If you know of a better way or a solution to this... I will be grateful.
Rgds [ August 07, 2007: Message edited by: Mike Anna ]
posted 13 years ago
err.. is this too complex a code.. ? :roll: May be it is.. thts why its posted here. I am still stuck with this one. Would appreciate any help in this aspect.
All the souls who tried to help.... May be I do not exceptionally understand Log4j... Heres the completely functional code that will take filename and filesize from a properties file.Inline comments. Thanks to whoever tried to help... enjoy