在记录结束之后加上 for(Handler h:log.getHandlers()) { h.close(); //must call h.close or a .LCK file will remain. }