StaticInfoLog { public synchronized static void logStaticInfo() { try { if (appender == null) { appender = new TimedRollingFileAppender("static-info.log", true); } String log = TracerUtils.getPID() + ","; log = log + (TracerUtils.getInetAddress() + ","); log = log + (TracerUtils.getCurrentZone() + ","); log = log + (TracerUtils.getDefaultTimeZone()); appender.append(log + "\n"); appender.flush(); } catch (IOException e) { SelfLog.error("", e); } }  synchronized static void logStaticInfo();  }
@Test public void testLogStaticInfo() throws IOException, InterruptedException, NoSuchFieldException, IllegalAccessException { reflect(); StaticInfoLog.logStaticInfo(); TestUtil.waitForAsyncLog(); List<String> params = new ArrayList<String>(); params.add(TracerUtils.getPID()); params.add(TracerUtils.getInetAddress()); params.add(TracerUtils.getCurrentZone()); params.add(TracerUtils.getDefaultTimeZone()); List<String> contents = FileUtils.readLines(customFileLog("static-info.log")); Assert.assertFalse("Static information log has no content", contents.isEmpty()); assertTrue(checkResult(params, contents.get(0))); }