/** Calling this method will <em>safely</em> close and remove all appenders in all the categories including root contained in the default hierachy. <p>Some appenders such as {@link org.apache.log4j.net.SocketAppender} and {@link AsyncAppender} need to be closed before the application exists. Otherwise, pending logging events might be lost. <p>The <code>shutdown</code> method is careful to close nested appenders before closing regular appenders. This is allows configurations where a regular appender is attached to a category and again to a nested appender. @deprecated Please use {@link LogManager#shutdown()} instead. @since 1.0 */ public static void shutdown() { LogManager.shutdown(); }
/** * Cleans up the logger configuration. Should be used in unit tests only for sequential tests run with * different configurations */ static void cleanup() { synchronized (mux) { if (inited) LogManager.shutdown(); inited = false; } } }
@Override public void shutdown() { LogManager.shutdown(); }
/** * Configures root logger, either for FILE output or just console. */ public static void configureLogger() { LogManager.shutdown(); String logFile = getConfigBoolean("log.save", false) ? "log4j.file.properties" : "log4j.properties"; try (InputStream stream = Utils.class.getClassLoader().getResourceAsStream(logFile)) { if (stream == null) { PropertyConfigurator.configure("src/main/resources/" + logFile); } else { PropertyConfigurator.configure(stream); } LOGGER.info("Loaded " + logFile); } catch (IOException e) { LOGGER.error(e.getMessage(), e); } }
/** * @param args Command line args */ public static void main(String[] args) { boolean result = false; try { JstormMaster appMaster = new JstormMaster(); LOG.info("Initializing Jstorm Master!"); boolean doRun = appMaster.init(args); if (!doRun) { System.exit(JOYConstants.EXIT_SUCCESS); } appMaster.run(); // LRS won't finish at all result = appMaster.finish(); } catch (Throwable t) { LOG.fatal("Error running JstormMaster", t); LogManager.shutdown(); ExitUtil.terminate(JOYConstants.EXIT_FAIL1, t); } if (result) { LOG.info("Application Master completed successfully. exiting"); System.exit(JOYConstants.EXIT_SUCCESS); } else { LOG.info("Application Master failed. exiting"); System.exit(JOYConstants.EXIT_FAIL2); } }
if (!relinquishLoggingControl) LogManager.shutdown(); LogFactory.release(Thread.currentThread().getContextClassLoader());
/** * Shut down log4j, properly releasing all file locks. * <p>This isn't strictly necessary, but recommended for shutting down * log4j in a scenario where the host VM stays alive (for example, when * shutting down an application in a J2EE environment). */ public static void shutdownLogging() { LogManager.shutdown(); }
/** Calling this method will <em>safely</em> close and remove all appenders in all the categories including root contained in the default hierachy. <p>Some appenders such as {@link org.apache.log4j.net.SocketAppender} and {@link AsyncAppender} need to be closed before the application exists. Otherwise, pending logging events might be lost. <p>The <code>shutdown</code> method is careful to close nested appenders before closing regular appenders. This is allows configurations where a regular appender is attached to a category and again to a nested appender. @deprecated Please use {@link LogManager#shutdown()} instead. @since 1.0 */ public static void shutdown() { LogManager.shutdown(); }
/** Calling this method will <em>safely</em> close and remove all appenders in all the categories including root contained in the default hierachy. <p>Some appenders such as {@link org.apache.log4j.net.SocketAppender} and {@link AsyncAppender} need to be closed before the application exists. Otherwise, pending logging events might be lost. <p>The <code>shutdown</code> method is careful to close nested appenders before closing regular appenders. This is allows configurations where a regular appender is attached to a category and again to a nested appender. @deprecated Please use {@link LogManager#shutdown()} instead. @since 1.0 */ public static void shutdown() { LogManager.shutdown(); }
/** * @param args Command line args */ public static void main(String[] args) { boolean result = false; try { ApplicationMaster appMaster = new ApplicationMaster(); LOG.info("Initializing ApplicationMaster"); boolean doRun = appMaster.init(args); if (!doRun) { System.exit(0); } appMaster.run(); result = appMaster.finish(); } catch (Throwable t) { LOG.fatal("Error running ApplicationMaster", t); LogManager.shutdown(); ExitUtil.terminate(1, t); } if (result) { LOG.info("Application Master completed successfully. exiting"); System.exit(0); } else { LOG.info("Application Master failed. exiting"); System.exit(2); } }
LogManager.shutdown();
/** * Cleans up the logger configuration. Should be used in unit tests only for sequential tests run with * different configurations */ static void cleanup() { synchronized (mux) { if (inited) LogManager.shutdown(); inited = false; } } }
/** * Shut down Log4J, properly releasing all file locks. * <p>This isn't strictly necessary, but recommended for shutting down * Log4J in a scenario where the host VM stays alive (for example, when * shutting down an application in a J2EE environment). */ public static void shutdownLogging() { LogManager.shutdown(); }
@Override public void contextDestroyed(ServletContextEvent contextEvent) { ServletContext servletContext = contextEvent.getServletContext(); String contextPath = servletContext.getContextPath(); // Make sure locks on log files are released LogManager.shutdown(); servletContext.log("Shutdown log4j for " + contextPath); } }
public static synchronized void syncLogsShutdown( ScheduledExecutorService scheduler) { // flush standard streams // System.out.flush(); System.err.flush(); if (scheduler != null) { scheduler.shutdownNow(); } // flush & close all appenders LogManager.shutdown(); }
public static synchronized void syncLogsShutdown( ScheduledExecutorService scheduler) { // flush standard streams // System.out.flush(); System.err.flush(); if (scheduler != null) { scheduler.shutdownNow(); } // flush & close all appenders LogManager.shutdown(); }
private void cleanupAfterOurselves(OpTimerFactory opTimerFactory) { cleanupThreadLocals(opTimerFactory); // and shutdown log4j for good measure LogManager.shutdown(); }
@Override protected void serviceStop() throws Exception { super.serviceStop(); LogManager.shutdown(); }
@Override public void run() { if (!shutdownStarted.compareAndSet(false, true)) { return; } doRun(); shutdownComplete.countDown(); if (ensureProcessShutdown) { // ensures that log4j will always flush the log buffers LOGGER.info("Stopping log4j..."); LogManager.shutdown(); } }
/** * Destroy the log service. */ public void destroy() { LogManager.shutdown(); XLog.Info.reset(); XLogFilter.reset(); }