本文整理汇总了Java中java.util.logging.Handler.close方法的典型用法代码示例。如果您正苦于以下问题:Java Handler.close方法的具体用法?Java Handler.close怎么用?Java Handler.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.logging.Handler
的用法示例。
在下文中一共展示了Handler.close方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: close
import java.util.logging.Handler; //导入方法依赖的package包/类
/** Does its best to close provided handler. Can close handlers created by
* {@link #createDispatchHandler(java.util.logging.Handler, int)} as well.
*/
public static void close(Handler h) {
if (h == null) {
return;
}
if (h instanceof DispatchingHandler) {
((DispatchingHandler)h).doClose();
} else {
h.close();
}
}
示例2: closeLogHandlers
import java.util.logging.Handler; //导入方法依赖的package包/类
public static void closeLogHandlers(Logger log) {
if (DEBUG) {
for (Handler e: log.getHandlers()) {
e.close();
}
}
}
示例3: disable
import java.util.logging.Handler; //导入方法依赖的package包/类
private void disable() {
getProxy().getLogger().info("Disabling plugin " + getDescription().getName() + " version " + getDescription().getVersion() + " by " + getDescription().getAuthor());
try {
onDisable();
for (Handler handler : getLogger().getHandlers())
handler.close();
} catch (Exception exception) {
exception.printStackTrace();
}
getProxy().getScheduler().cancel(this);
getExecutorService().shutdownNow();
getProxy().getLogger().info("Disabled plugin " + getDescription().getName() + " version " + getDescription().getVersion() + " by " + getDescription().getAuthor());
}
示例4: freeResources
import java.util.logging.Handler; //导入方法依赖的package包/类
/**
* This function frees the logger's handlers and deletes the temp file
*/
private static void freeResources(){
configuration.closeAndDeleteFile();
//Free resources
for (Handler handle : configuration.getLogger().getHandlers()) {
handle.close();
}
}
示例5: cleanupLogger
import java.util.logging.Handler; //导入方法依赖的package包/类
/**
* Removed all the handlers of the given {@link Logger} instance.
*
* @param logger {@link Logger} to be cleaned up.
*/
private static void cleanupLogger(Logger logger) {
if (logger != null) {
Handler[] handlers = logger.getHandlers();
for (Handler handler : handlers) {
handler.close();
logger.removeHandler(handler);
}
}
}
示例6: getLogFile
import java.util.logging.Handler; //导入方法依赖的package包/类
/** Obtiene, en formato XML, el registro acumulado de la ejecución actual.
* @return Registro acumulado de la ejecución actual
* @throws IOException Si no hay registro o este no se puede leer */
public static String getLogFile() throws IOException {
if (!installed || logFile == null) {
throw new IOException("No esta instalado el manejador de fichero"); //$NON-NLS-1$
}
final Handler[] handlers = LOGGER.getHandlers();
for (final Handler h : handlers) {
if (h instanceof FileHandler) {
h.close();
LOGGER.info("Cerrado el manejador de fichero para permitir que sea procesado"); //$NON-NLS-1$
LOGGER.removeHandler(h);
}
}
final InputStream is = new FileInputStream(
new File(
logFile.replace("%h", Platform.getUserHome()) //$NON-NLS-1$
)
);
final String log = new String(AOUtil.getDataFromInputStream(is));
is.close();
LOGGER.addHandler(createFileHandler(logFile));
return log;
}
示例7: shutdown
import java.util.logging.Handler; //导入方法依赖的package包/类
private void shutdown(ActionEvent event) {
this.logger.info("Courier v" + Version.getVersion() + " shutting down!");
if (this.integration != null) {
this.integration.stop();
}
for (Handler handler : this.logger.getHandlers()) { // Close our logger handler
handler.close();
}
DiscordRPC.DiscordShutdown();
System.exit(0);
}
示例8: close
import java.util.logging.Handler; //导入方法依赖的package包/类
public void close() throws SecurityException {
for (Handler h : instances) {
h.close();
}
}
示例9: close
import java.util.logging.Handler; //导入方法依赖的package包/类
@Override
public void close() throws SecurityException {
for (Handler h : Lookup.getDefault().lookupAll(Handler.class)) {
h.close();
}
}