org.apache.log4j.LogManager.shutdown()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(142)

本文整理了Java中org.apache.log4j.LogManager.shutdown()方法的一些代码示例,展示了LogManager.shutdown()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LogManager.shutdown()方法的具体详情如下:
包路径:org.apache.log4j.LogManager
类名称:LogManager
方法名:shutdown

LogManager.shutdown介绍

[英]No-op implementation.
[中]没有op实现。

代码示例

代码示例来源:origin: log4j/log4j

/**
  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();
}

代码示例来源:origin: apache/ignite

/**
   * 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;
    }
  }
}

代码示例来源:origin: org.apache.logging.log4j/log4j-core

@Override
public void shutdown() {
  LogManager.shutdown();
}

代码示例来源:origin: RipMeApp/ripme

/**
 * 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);
  }
}

代码示例来源:origin: alibaba/jstorm

/**
 * @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);
  }
}

代码示例来源:origin: geoserver/geoserver

if (!relinquishLoggingControl) LogManager.shutdown();
LogFactory.release(Thread.currentThread().getContextClassLoader());

代码示例来源:origin: camunda/camunda-bpm-platform

/**
 * 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();
}

代码示例来源:origin: camunda/camunda-bpm-platform

/**
  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();
}

代码示例来源:origin: apache/log4j

/**
  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();
}

代码示例来源:origin: apache/metron

/**
 * @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);
 }
}

代码示例来源:origin: openmrs/openmrs-core

LogManager.shutdown();

代码示例来源:origin: org.apache.ignite/ignite-log4j

/**
   * 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;
    }
  }
}

代码示例来源:origin: springframework/spring-core

/**
 * 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();
}

代码示例来源:origin: com.github.susom/server-logging

@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);
 }
}

代码示例来源:origin: io.hops/hadoop-mapreduce-client-core

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(); 
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-mapreduce-client-core

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(); 
}

代码示例来源:origin: com.atlassian.jira/jira-core

private void cleanupAfterOurselves(OpTimerFactory opTimerFactory)
{
  cleanupThreadLocals(opTimerFactory);
  // and shutdown log4j for good measure
  LogManager.shutdown();
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-mapreduce-client-app

@Override
protected void serviceStop() throws Exception {
 super.serviceStop();
 LogManager.shutdown();
}

代码示例来源:origin: com.hazelcast.simulator/simulator

@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();
  }
}

代码示例来源:origin: apache/oozie

/**
 * Destroy the log service.
 */
public void destroy() {
  LogManager.shutdown();
  XLog.Info.reset();
  XLogFilter.reset();
}

相关文章