想把java写的接口程序中生成的日志修改为有限制的大小,请问各位该如何修改 我经验不够
源代码如下:
public class LoggingUtil {
private LoggingUtil() {}
volatile private static Logger errorLog;
public static Logger getLogger() {
if (errorLog == null) {
synchronized (LoggingUtil.class) {
if (errorLog == null) {
FileHandler handler = null;
try {
handler = new FileHandler("error.log", true
);
} catch (IOException e) {}
SimpleFormatter formatter = new SimpleFormatter();
handler.setFormatter(formatter);
errorLog = Logger.getLogger("Error");
errorLog.setUseParentHandlers(false);
errorLog.addHandler(handler);
}
}
}
return errorLog;
}
}