Java Code Examples for java.util.logging.Handler.close()

The following are Jave code examples for showing how to use close() of the java.util.logging.Handler class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: incubator-netbeans   File: NbLogging.java   Source Code and License Vote up 5 votes
/** 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();
    }
}
 
Example 2
Project: gw2_launcher   File: Operations.java   Source Code and License Vote up 5 votes
public static void closeLogHandlers(Logger log) {
	if (DEBUG) {
		for (Handler e: log.getHandlers()) {
			e.close();
		}
	}
}
 
Example 3
Project: Banmanager   File: BanmanagerProxy.java   Source Code and License Vote up 5 votes
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());
}
 
Example 4
Project: ShowPolicyPackage   File: ShowPackageTool.java   Source Code and License Vote up 5 votes
/**
 * 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();
    }
}
 
Example 5
Project: monarch   File: LogWrapper.java   Source Code and License Vote up 5 votes
/**
 * 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);
    }
  }
}
 
Example 6
Project: mi-firma-android   File: LogManager.java   Source Code and License Vote up 5 votes
/** 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;
}
 
Example 7
Project: courier   File: Courier.java   Source Code and License Vote up 5 votes
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);
}
 
Example 8
Project: incubator-netbeans   File: TopLogging.java   Source Code and License Vote up 4 votes
public void close() throws SecurityException {
    for (Handler h : instances) {
        h.close();
    }
}
 
Example 9
Project: incubator-netbeans   File: LogsTooEarlyTest.java   Source Code and License Vote up 4 votes
@Override
public void close() throws SecurityException {
    for (Handler h : Lookup.getDefault().lookupAll(Handler.class)) {
        h.close();
    }
}