import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
import java.util.logging.MemoryHandler;
public class Main {
public static void main(String[] argv) throws Exception {
FileHandler fhandler = new FileHandler("my.log");
int numRec = 100;
MemoryHandler mhandler = new MemoryHandler(fhandler, numRec, Level.OFF) {
public synchronized void publish(LogRecord record) {
super.publish(record);
push();
}
};
Logger logger = Logger.getLogger("com.mycompany");
logger.addHandler(mhandler);
}
}