下面列出了java.util.logging.FileHandler#flush ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private static FileHandler createFileHandler(File writableDir) throws SecurityException,
RuntimeException, IOException {
// Test 1: make sure we can create FileHandler in writable directory
try {
FileHandler handler = new FileHandler("%t/" + WRITABLE_DIR + "/log.log");
handler.publish(new LogRecord(Level.INFO, handler.toString()));
handler.flush();
return handler;
} catch (IOException ex) {
throw new RuntimeException("Test failed: should have been able"
+ " to create FileHandler for " + "%t/" + WRITABLE_DIR
+ "/log.log in writable directory.", ex);
}
}
private static FileHandler createFileHandler(File writableDir) throws SecurityException,
RuntimeException, IOException {
// Test 1: make sure we can create FileHandler in writable directory
try {
FileHandler handler = new FileHandler("%t/" + WRITABLE_DIR + "/log.log");
handler.publish(new LogRecord(Level.INFO, handler.toString()));
handler.flush();
return handler;
} catch (IOException ex) {
throw new RuntimeException("Test failed: should have been able"
+ " to create FileHandler for " + "%t/" + WRITABLE_DIR
+ "/log.log in writable directory.", ex);
}
}
private static FileHandler createFileHandler(File writableDir) throws SecurityException,
RuntimeException, IOException {
// Test 1: make sure we can create FileHandler in writable directory
try {
FileHandler handler = new FileHandler("%t/" + WRITABLE_DIR + "/log.log");
handler.publish(new LogRecord(Level.INFO, handler.toString()));
handler.flush();
return handler;
} catch (IOException ex) {
throw new RuntimeException("Test failed: should have been able"
+ " to create FileHandler for " + "%t/" + WRITABLE_DIR
+ "/log.log in writable directory.", ex);
}
}
private static FileHandler createFileHandler(File writableDir) throws SecurityException,
RuntimeException, IOException {
// Test 1: make sure we can create FileHandler in writable directory
try {
FileHandler handler = new FileHandler("%t/" + WRITABLE_DIR + "/log.log");
handler.publish(new LogRecord(Level.INFO, handler.toString()));
handler.flush();
return handler;
} catch (IOException ex) {
throw new RuntimeException("Test failed: should have been able"
+ " to create FileHandler for " + "%t/" + WRITABLE_DIR
+ "/log.log in writable directory.", ex);
}
}
private static FileHandler createFileHandler(File writableDir) throws SecurityException,
RuntimeException, IOException {
// Test 1: make sure we can create FileHandler in writable directory
try {
FileHandler handler = new FileHandler("%t/" + WRITABLE_DIR + "/log.log");
handler.publish(new LogRecord(Level.INFO, handler.toString()));
handler.flush();
return handler;
} catch (IOException ex) {
throw new RuntimeException("Test failed: should have been able"
+ " to create FileHandler for " + "%t/" + WRITABLE_DIR
+ "/log.log in writable directory.", ex);
}
}
private static FileHandler createFileHandler(File writableDir) throws SecurityException,
RuntimeException, IOException {
// Test 1: make sure we can create FileHandler in writable directory
try {
FileHandler handler = new FileHandler("%t/" + WRITABLE_DIR + "/log.log");
handler.publish(new LogRecord(Level.INFO, handler.toString()));
handler.flush();
return handler;
} catch (IOException ex) {
throw new RuntimeException("Test failed: should have been able"
+ " to create FileHandler for " + "%t/" + WRITABLE_DIR
+ "/log.log in writable directory.", ex);
}
}
private static FileHandler createFileHandler(File writableDir) throws SecurityException,
RuntimeException, IOException {
// Test 1: make sure we can create FileHandler in writable directory
try {
FileHandler handler = new FileHandler("%t/" + WRITABLE_DIR + "/log.log");
handler.publish(new LogRecord(Level.INFO, handler.toString()));
handler.flush();
return handler;
} catch (IOException ex) {
throw new RuntimeException("Test failed: should have been able"
+ " to create FileHandler for " + "%t/" + WRITABLE_DIR
+ "/log.log in writable directory.", ex);
}
}
private static FileHandler createFileHandler(File writableDir) throws SecurityException,
RuntimeException, IOException {
// Test 1: make sure we can create FileHandler in writable directory
try {
FileHandler handler = new FileHandler("%t/" + WRITABLE_DIR + "/log.log");
handler.publish(new LogRecord(Level.INFO, handler.toString()));
handler.flush();
return handler;
} catch (IOException ex) {
throw new RuntimeException("Test failed: should have been able"
+ " to create FileHandler for " + "%t/" + WRITABLE_DIR
+ "/log.log in writable directory.", ex);
}
}
private static FileHandler createFileHandler(File writableDir) throws SecurityException,
RuntimeException, IOException {
// Test 1: make sure we can create FileHandler in writable directory
try {
FileHandler handler = new FileHandler("%t/" + WRITABLE_DIR + "/log.log");
handler.publish(new LogRecord(Level.INFO, handler.toString()));
handler.flush();
return handler;
} catch (IOException ex) {
throw new RuntimeException("Test failed: should have been able"
+ " to create FileHandler for " + "%t/" + WRITABLE_DIR
+ "/log.log in writable directory.", ex);
}
}
private static FileHandler createFileHandler(File writableDir) throws SecurityException,
RuntimeException, IOException {
// Test 1: make sure we can create FileHandler in writable directory
try {
FileHandler handler = new FileHandler("%t/" + WRITABLE_DIR + "/log.log");
handler.publish(new LogRecord(Level.INFO, handler.toString()));
handler.flush();
return handler;
} catch (IOException ex) {
throw new RuntimeException("Test failed: should have been able"
+ " to create FileHandler for " + "%t/" + WRITABLE_DIR
+ "/log.log in writable directory.", ex);
}
}
/** {@inheritDoc} */
@SuppressWarnings("NonSynchronizedMethodOverridesSynchronizedMethod")
@Override public void flush() {
FileHandler delegate0 = delegate;
if (delegate0 != null)
delegate0.flush();
}
private static FileHandler createFileHandler(File writableDir) throws SecurityException,
RuntimeException, IOException {
// Test 1: make sure we can create FileHandler in writable directory
try {
FileHandler handler = new FileHandler("%t/" + WRITABLE_DIR + "/log.log");
handler.publish(new LogRecord(Level.INFO, handler.toString()));
handler.flush();
return handler;
} catch (IOException ex) {
throw new RuntimeException("Test failed: should have been able"
+ " to create FileHandler for " + "%t/" + WRITABLE_DIR
+ "/log.log in writable directory.", ex);
}
}