import java.util.logging.FileHandler; import java.util.logging.Level; 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.SEVERE); Logger logger = Logger.getLogger("com.mycompany"); logger.addHandler(mhandler); } }