I have the following logging problem with several Java applications using log4j for logging:
I want log files to be rotated daily, like
I create this Methode and call it by closing the application:
public void deleteFiles(){
File f = new File("log");
File[] fileArray = f.listFiles();
double timenow = System.currentTimeMillis();
double olderTenDays = timenow - 864000000;// MS for ten days
for (int i = 0; i < fileArray.length; i++) {
if(fileArray[i].lastModified()< olderTenDays )
fileArray[i].delete();
}
}