public void run() { long last = System.currentTimeMillis(); while (true) { long now = System.currentTimeMillis(); if (now > last + DateUtil.MILLIS_PER_HOUR) { last = now; clearOldLog(); } if (lastDataUnit != DateUtil.getDateUnit()) { pw = (PrintWriter) FileUtil.close(pw); lastDataUnit = DateUtil.getDateUnit(); } ThreadUtil.sleep(5000); } } };
private synchronized void process() { long now = System.currentTimeMillis(); if (now > last + DateUtil.MILLIS_PER_HOUR) { last = now; clearOldLog(); } if (CompareUtil.equals(lastDir, conf.log_dir) == false // || lastFileRotation != conf.log_rotation_enabled // || lastDataUnit != DateUtil.getDateUnit() // || scouter_name.equals(conf.obj_name) == false// || (logfile != null && logfile.exists() == false)) { pw = (PrintWriter) FileUtil.close(pw); logfile = null; lastDir = conf.log_dir; lastFileRotation = conf.log_rotation_enabled; lastDataUnit = DateUtil.getDateUnit(); scouter_name = conf.obj_name; } try { openFile(scouter_name); } catch (Throwable t) { sysout(t.getMessage()); } } };
private synchronized void process() { long now = System.currentTimeMillis(); if (now > last + DateUtil.MILLIS_PER_HOUR) { last = now; clearOldLog(); } if (CompareUtil.equals(lastDir, conf.log_dir) == false // || lastFileRotation != conf.log_rotation_enabled // || lastDataUnit != DateUtil.getDateUnit() // || scouter_name.equals(conf.obj_name) == false// || (logfile != null && logfile.exists() == false)) { pw = (PrintWriter) FileUtil.close(pw); logfile = null; lastDir = conf.log_dir; lastFileRotation = conf.log_rotation_enabled; lastDataUnit = DateUtil.getDateUnit(); scouter_name = conf.obj_name; } try { openFile(scouter_name); } catch (Throwable t) { sysout(t.getMessage()); } } };
private synchronized void process() { long now = System.currentTimeMillis(); if (now > last + DateUtil.MILLIS_PER_HOUR) { last = now; clearOldLog(); } if (CompareUtil.equals(lastDir, conf.log_dir) == false // || lastFileRotation != conf.log_rotation_enabled // || lastDataUnit != DateUtil.getDateUnit() // || scouter_name.equals(conf.obj_name) == false// || (logfile != null && logfile.exists() == false)) { pw = (PrintWriter) FileUtil.close(pw); logfile = null; lastDir = conf.log_dir; lastFileRotation = conf.log_rotation_enabled; lastDataUnit = DateUtil.getDateUnit(); scouter_name = conf.obj_name; } try { openFile(scouter_name); } catch (Throwable t) { sysout(t.getMessage()); } } };