org.apache.logging.log4j.core.config.Configuration.isShutdownHookEnabled()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(1.9k)|赞(0)|评价(0)|浏览(136)

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

Configuration.isShutdownHookEnabled介绍

暂无

代码示例

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

@Test
public void testShutdownFlag() {
  final Configuration config = context.getConfiguration();
  assertNotNull("No configuration", config);
  assertFalse("Shutdown hook is enabled", config.isShutdownHookEnabled());
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

/**
 * Starts with a specific configuration.
 *
 * @param config The new Configuration.
 */
public void start(final Configuration config) {
  LOGGER.debug("Starting LoggerContext[name={}, {}] with configuration {}...", getName(), this, config);
  if (configLock.tryLock()) {
    try {
      if (this.isInitialized() || this.isStopped()) {
        if (this.configuration.isShutdownHookEnabled()) {
          setUpShutdownHook();
        }
        this.setStarted();
      }
    } finally {
      configLock.unlock();
    }
  }
  setConfiguration(config);
  LOGGER.debug("LoggerContext[name={}, {}] started OK with configuration {}.", getName(), this, config);
}

代码示例来源:origin: ops4j/org.ops4j.pax.logging

@Override
public void start() {
  LOGGER.debug("Starting LoggerContext[name={}, {}]...", getName(), this);
  if (PropertiesUtil.getProperties().getBooleanProperty("log4j.LoggerContext.stacktrace.on.start", false)) {
    LOGGER.debug("Stack trace to locate invoker",
        new Exception("Not a real error, showing stack trace to locate invoker"));
  }
  if (configLock.tryLock()) {
    try {
      if (this.isInitialized() || this.isStopped()) {
        this.setStarting();
        reconfigure();
        if (this.configuration.isShutdownHookEnabled()) {
          setUpShutdownHook();
        }
        this.setStarted();
      }
    } finally {
      configLock.unlock();
    }
  }
  LOGGER.debug("LoggerContext[name={}, {}] started OK.", getName(), this);
}

相关文章