当前位置: 首页>>代码示例>>Java>>正文


Java LogManager.shutdown方法代码示例

本文整理汇总了Java中org.apache.log4j.LogManager.shutdown方法的典型用法代码示例。如果您正苦于以下问题:Java LogManager.shutdown方法的具体用法?Java LogManager.shutdown怎么用?Java LogManager.shutdown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.log4j.LogManager的用法示例。


在下文中一共展示了LogManager.shutdown方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureLogger

import org.apache.log4j.LogManager; //导入方法依赖的package包/类
/**
 * Configures root logger, either for FILE output or just console.
 */
public static void configureLogger() {
    LogManager.shutdown();
    String logFile;
    if (getConfigBoolean("log.save", false)) {
        logFile = "log4j.file.properties";
    }
    else {
        logFile = "log4j.properties";
    }
    InputStream stream = Utils.class.getClassLoader().getResourceAsStream(logFile);
    if (stream == null) {
        PropertyConfigurator.configure("src/main/resources/" + logFile);
    } else {
        PropertyConfigurator.configure(stream);
    }
    logger.info("Loaded " + logFile);
    try {
        stream.close();
    } catch (IOException e) { }
}
 
开发者ID:RipMeApp,项目名称:ripme,代码行数:24,代码来源:Utils.java

示例2: testWriteHeaderAndFooter

import org.apache.log4j.LogManager; //导入方法依赖的package包/类
@Test
public void testWriteHeaderAndFooter() throws Exception
{
    initialize("TestSNSAppender/testWriteHeaderAndFooter.properties");

    logger.debug("message");

    // must retrieve writer before we shut down
    MockSNSWriter writer = appender.getMockWriter();
    LogManager.shutdown();

    assertEquals("number of messages written to log",   3,                          writer.messages.size());
    assertEquals("header is first",                     HeaderFooterLayout.HEADER,  writer.getMessage(0));
    assertEquals("message is second",                   "message",                  writer.getMessage(1));
    assertEquals("footer is last",                      HeaderFooterLayout.FOOTER,  writer.getMessage(2));
}
 
开发者ID:kdgregory,项目名称:log4j-aws-appenders,代码行数:17,代码来源:TestSNSAppender.java

示例3: main

import org.apache.log4j.LogManager; //导入方法依赖的package包/类
/**
 * @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);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:ApplicationMaster.java

示例4: configureAuditLogs

import org.apache.log4j.LogManager; //导入方法依赖的package包/类
private void configureAuditLogs() throws IOException {
  // Shutdown the LogManager to release all logger open file handles.
  // Unfortunately, Apache commons logging library does not provide
  // means to release underlying loggers. For additional info look up
  // commons library FAQ.
  LogManager.shutdown();

  File file = new File(auditLogFile);
  if (file.exists()) {
    assertTrue(file.delete());
  }
  Logger logger = ((Log4JLogger) FSNamesystem.auditLog).getLogger();
  // disable logging while the cluster startup preps files
  logger.setLevel(Level.OFF);
  PatternLayout layout = new PatternLayout("%m%n");
  RollingFileAppender appender = new RollingFileAppender(layout, auditLogFile);
  logger.addAppender(appender);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestAuditLogs.java

示例5: testWriteHeaderAndFooter

import org.apache.log4j.LogManager; //导入方法依赖的package包/类
@Test
public void testWriteHeaderAndFooter() throws Exception
{
    initialize("TestCloudWatchAppender/testWriteHeaderAndFooter.properties");

    logger.debug("blah blah blah");

    // must retrieve writer before we shut down
    MockCloudWatchWriter mockWriter = appender.getMockWriter();
    LogManager.shutdown();

    assertEquals("number of messages written to log", 3, mockWriter.messages.size());
    assertEquals("header is first", HeaderFooterLayout.HEADER, mockWriter.getMessage(0));
    assertEquals("footer is last",  HeaderFooterLayout.FOOTER, mockWriter.getMessage(2));
}
 
开发者ID:kdgregory,项目名称:log4j-aws-appenders,代码行数:16,代码来源:TestCloudWatchAppender.java

示例6: testWriteHeaderAndFooter

import org.apache.log4j.LogManager; //导入方法依赖的package包/类
@Test
public void testWriteHeaderAndFooter() throws Exception
{
    initialize("TestKinesisAppender/testWriteHeaderAndFooter.properties");

    logger.debug("blah blah blah");

    // must retrieve writer before we shut down
    MockKinesisWriter writer = appender.getMockWriter();
    LogManager.shutdown();

    assertEquals("number of messages written to log", 3, writer.messages.size());
    assertEquals("header is first", HeaderFooterLayout.HEADER, writer.getMessage(0));
    assertEquals("footer is last",  HeaderFooterLayout.FOOTER, writer.getMessage(2));
}
 
开发者ID:kdgregory,项目名称:log4j-aws-appenders,代码行数:16,代码来源:TestKinesisAppender.java

示例7: syncLogsShutdown

import org.apache.log4j.LogManager; //导入方法依赖的package包/类
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(); 
}
 
开发者ID:naver,项目名称:hadoop,代码行数:16,代码来源:TaskLog.java

示例8: destroy

import org.apache.log4j.LogManager; //导入方法依赖的package包/类
/**
 * Destroys the server.
 * <p>
 * All services are destroyed in reverse order of initialization, then the
 * Log4j framework is shutdown.
 */
public void destroy() {
  ensureOperational();
  destroyServices();
  log.info("Server [{}] shutdown!", name);
  log.info("======================================================");
  if (!Boolean.getBoolean("test.circus")) {
    LogManager.shutdown();
  }
  status = Status.SHUTDOWN;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:Server.java

示例9: serviceStop

import org.apache.log4j.LogManager; //导入方法依赖的package包/类
@Override
protected void serviceStop() throws Exception {
  super.serviceStop();
  LogManager.shutdown();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:6,代码来源:MRAppMaster.java

示例10: destroyLog4j

import org.apache.log4j.LogManager; //导入方法依赖的package包/类
private void destroyLog4j() {
    LogManager.shutdown();
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:4,代码来源:InitApp.java

示例11: destroyLog4j

import org.apache.log4j.LogManager; //导入方法依赖的package包/类
@PreDestroy
private void destroyLog4j() {
	LogManager.shutdown();
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:5,代码来源:JDBCAppenderConfig.java


注:本文中的org.apache.log4j.LogManager.shutdown方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。