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


Java LogService类代码示例

本文整理汇总了Java中org.apache.geode.internal.logging.LogService的典型用法代码示例。如果您正苦于以下问题:Java LogService类的具体用法?Java LogService怎么用?Java LogService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LogService类属于org.apache.geode.internal.logging包,在下文中一共展示了LogService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hasLoggerFilter

import org.apache.geode.internal.logging.LogService; //导入依赖的package包/类
public static boolean hasLoggerFilter(final Configuration config) {
  for (LoggerConfig loggerConfig : config.getLoggers().values()) {
    boolean isRoot = loggerConfig.getName().equals("");
    boolean isGemFire = loggerConfig.getName().startsWith(LogService.BASE_LOGGER_NAME);
    boolean hasFilter = loggerConfig.hasFilter();
    boolean isGemFireVerboseFilter =
        hasFilter && (LogService.GEODE_VERBOSE_FILTER.equals(loggerConfig.getFilter().toString())
            || LogService.GEMFIRE_VERBOSE_FILTER.equals(loggerConfig.getFilter().toString()));

    if (isRoot || isGemFire) {
      // check for Logger Filter
      if (hasFilter && !isGemFireVerboseFilter) {
        return true;
      }
    }
  }
  return false;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:19,代码来源:Configurator.java

示例2: hasAppenderRefFilter

import org.apache.geode.internal.logging.LogService; //导入依赖的package包/类
public static boolean hasAppenderRefFilter(final Configuration config) {
  for (LoggerConfig loggerConfig : config.getLoggers().values()) {
    boolean isRoot = loggerConfig.getName().equals("");
    boolean isGemFire = loggerConfig.getName().startsWith(LogService.BASE_LOGGER_NAME);

    if (isRoot || isGemFire) {
      // check for AppenderRef Filter
      for (AppenderRef appenderRef : loggerConfig.getAppenderRefs()) {
        if (appenderRef.getFilter() != null) {
          return true;
        }
      }
    }
  }
  return false;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:17,代码来源:Configurator.java

示例3: testNoAccess

import org.apache.geode.internal.logging.LogService; //导入依赖的package包/类
@Test
@ConnectionConfiguration(user = "stranger", password = "1234567")
public void testNoAccess() {
  for (TestCommand command : commands) {
    // skip query commands since query commands are only available in client shell
    if (command.getCommand().startsWith("query"))
      continue;
    LogService.getLogger().info("processing: " + command.getCommand());
    // for those commands that requires a permission, we expect an exception to be thrown
    if (command.getPermission() != null) {
      try {
        String result = bean.processCommand(command.getCommand());
        fail(command.getCommand() + " has result: " + result);
      } catch (NotAuthorizedException e) {
        assertTrue(e.getMessage() + " should contain " + command.getPermission(),
            e.getMessage().contains(command.getPermission().toString()));
      }
    }
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:21,代码来源:CliCommandsSecurityTest.java

示例4: tearDown

import org.apache.geode.internal.logging.LogService; //导入依赖的package包/类
@After
public void tearDown() throws Exception {
  Configurator.shutdown();

  System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
  if (this.beforeConfigFileProp != null) {
    System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
        this.beforeConfigFileProp);
  }
  StatusLogger.getLogger().setLevel(this.beforeLevel);

  LogService.reconfigure();
  assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigInformation())
      .isTrue();

  BasicAppender.clearInstance();

  assertThat(this.systemErrRule.getLog()).isEmpty();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:20,代码来源:GeodeVerboseLogMarkerIntegrationTest.java

示例5: setUp

import org.apache.geode.internal.logging.LogService; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
  Configurator.shutdown();
  BasicAppender.clearInstance();

  this.beforeConfigFileProp =
      System.getProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
  this.beforeLevel = StatusLogger.getLogger().getLevel();

  this.customConfigFile = createConfigFileIn(this.temporaryFolder.getRoot());

  System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
      this.customConfigFile.getAbsolutePath());
  LogService.reconfigure();
  assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigInformation())
      .isFalse();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:18,代码来源:CustomConfigWithLogServiceIntegrationTest.java

示例6: logEventShouldMatchCustomConfig

import org.apache.geode.internal.logging.LogService; //导入依赖的package包/类
@Test
public void logEventShouldMatchCustomConfig() throws Exception {
  String logLogger = getClass().getName();
  Level logLevel = Level.DEBUG;
  String logMessage = "this is a log statement";

  Logger logger = LogService.getLogger();
  logger.debug(logMessage);

  BasicAppender appender = BasicAppender.getInstance();
  assertThat(appender).isNotNull();
  assertThat(appender.events()).hasSize(1);

  LogEvent event = appender.events().get(0);
  assertThat(event.getLoggerName()).isEqualTo(logLogger);
  assertThat(event.getLevel()).isEqualTo(logLevel);
  assertThat(event.getMessage().getFormattedMessage()).isEqualTo(logMessage);

  assertThat(systemOutRule.getLog()).contains(logLevel.name());
  assertThat(systemOutRule.getLog()).contains(logMessage);
  assertThat(systemOutRule.getLog()).contains(CONFIG_LAYOUT_PREFIX);
  assertThat(systemOutRule.getLog()).matches(defineLogStatementRegex(logLevel, logMessage));
}
 
开发者ID:ampool,项目名称:monarch,代码行数:24,代码来源:CustomConfigWithLogServiceIntegrationTest.java

示例7: tearDown

import org.apache.geode.internal.logging.LogService; //导入依赖的package包/类
@After
public void tearDown() throws Exception {
  if (this.cache != null) {
    this.cache.getDistributedSystem().disconnect();
  }

  Configurator.shutdown();

  System.clearProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY);
  if (this.beforeConfigFileProp != null) {
    System.setProperty(ConfigurationFactory.CONFIGURATION_FILE_PROPERTY,
        this.beforeConfigFileProp);
  }
  StatusLogger.getLogger().setLevel(this.beforeLevel);

  LogService.reconfigure();
  assertThat(LogService.isUsingGemFireDefaultConfig()).as(LogService.getConfigInformation())
      .isTrue();

  BasicAppender.clearInstance();

  assertThat(this.systemErrRule.getLog()).isEmpty();
}
 
开发者ID:ampool,项目名称:monarch,代码行数:24,代码来源:CustomConfigWithCacheIntegrationTest.java

示例8: addSuspectFileAppender

import org.apache.geode.internal.logging.LogService; //导入依赖的package包/类
/**
 * Add an appender to Log4j which sends all INFO+ messages to a separate file which will be used
 * later to scan for suspect strings. The pattern of the messages conforms to the original log
 * format so that hydra will be able to parse them.
 */
private static void addSuspectFileAppender(final String workspaceDir) {
  final String suspectFilename = new File(workspaceDir, SUSPECT_FILENAME).getAbsolutePath();

  final LoggerContext appenderContext =
      ((org.apache.logging.log4j.core.Logger) LogManager.getLogger(LogService.BASE_LOGGER_NAME))
          .getContext();

  final PatternLayout layout = PatternLayout.createLayout(
      "[%level{lowerCase=true} %date{yyyy/MM/dd HH:mm:ss.SSS z} <%thread> tid=%tid] %message%n%throwable%n",
      null, null, null, Charset.defaultCharset(), true, false, "", "");

  final FileAppender fileAppender = FileAppender.createAppender(suspectFilename, "true", "false",
      DUnitLauncher.class.getName(), "true", "false", "false", "0", layout, null, null, null,
      appenderContext.getConfiguration());
  fileAppender.start();

  LoggerConfig loggerConfig =
      appenderContext.getConfiguration().getLoggerConfig(LogService.BASE_LOGGER_NAME);
  loggerConfig.addAppender(fileAppender, Level.INFO, null);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:26,代码来源:DUnitLauncher.java

示例9: setLevel

import org.apache.geode.internal.logging.LogService; //导入依赖的package包/类
public void setLevel(final Level level) {
  if (getLevel().isLessSpecificThan(Level.DEBUG) || level.isLessSpecificThan(Level.DEBUG)) {
    debug("Changing level for Logger '{}' from {} to {}", this.loggerName, getLevel(), level);
  }

  if (LogService.MAIN_LOGGER_NAME.equals(this.loggerName)) {
    LogService.setBaseLogLevel(level);
  } else if (LogService.SECURITY_LOGGER_NAME.equals(this.loggerName)) {
    LogService.setSecurityLogLevel(level);
  } else {
    Configurator.setLevel(this.loggerName, level);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:14,代码来源:LogWriterLogger.java

示例10: addAlertListener

import org.apache.geode.internal.logging.LogService; //导入依赖的package包/类
public synchronized void addAlertListener(final DistributedMember member, final int alertLevel) {
  final Level level = LogService.toLevel(alertLevelToLogLevel(alertLevel));

  if (this.listeners.size() == 0) {
    this.appenderContext.getLoggerContext().addPropertyChangeListener(this);
  }

  addListenerToSortedList(new Listener(level, member));

  LoggerConfig loggerConfig = this.appenderContext.getLoggerConfig();
  loggerConfig.addAppender(this, this.listeners.get(0).getLevel(), null);
  if (logger.isDebugEnabled()) {
    logger.debug("Added/Replaced alert listener for member {} at level {}", member, level);
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:16,代码来源:AlertAppender.java

示例11: setLevel

import org.apache.geode.internal.logging.LogService; //导入依赖的package包/类
public static void setLevel(String name, Level level) {
  LoggerContext context = (LoggerContext) LogManager.getContext(false);
  LoggerConfig logConfig = getLoggerConfig(name);

  logConfig.setLevel(level);
  context.updateLoggers();

  if (level.isLessSpecificThan(Level.DEBUG)) {
    LogService.configureFastLoggerDelegating();
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:12,代码来源:Configurator.java

示例12: testAdminUser

import org.apache.geode.internal.logging.LogService; //导入依赖的package包/类
@Test
@ConnectionConfiguration(user = "super-user", password = "1234567")
public void testAdminUser() throws Exception {
  for (TestCommand command : commands) {
    LogService.getLogger().info("processing: " + command.getCommand());
    bean.processCommand(command.getCommand());
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:9,代码来源:CliCommandsSecurityTest.java

示例13: geodeVerboseShouldLogIfGeodeVerboseIsAccept

import org.apache.geode.internal.logging.LogService; //导入依赖的package包/类
@Test
public void geodeVerboseShouldLogIfGeodeVerboseIsAccept() {
  configureLogging(this.configFileGeodeVerboseAccept);
  Logger logger = LogService.getLogger();

  String msg = this.testName.getMethodName();
  logger.info(LogMarker.GEODE_VERBOSE, msg);

  assertThat(this.systemOutRule.getLog()).contains(msg);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:11,代码来源:GeodeVerboseLogMarkerIntegrationTest.java

示例14: geodeVerboseShouldNotLogIfGeodeVerboseIsDeny

import org.apache.geode.internal.logging.LogService; //导入依赖的package包/类
@Test
public void geodeVerboseShouldNotLogIfGeodeVerboseIsDeny() {
  configureLogging(this.configFileGeodeVerboseDeny);
  Logger logger = LogService.getLogger();

  String msg = this.testName.getMethodName();
  logger.info(LogMarker.GEODE_VERBOSE, msg);

  assertThat(this.systemOutRule.getLog()).doesNotContain(msg);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:11,代码来源:GeodeVerboseLogMarkerIntegrationTest.java

示例15: geodeVerboseShouldLogIfGemfireVerboseIsAccept

import org.apache.geode.internal.logging.LogService; //导入依赖的package包/类
@Test
public void geodeVerboseShouldLogIfGemfireVerboseIsAccept() {
  configureLogging(this.configFileGemfireVerboseAccept);
  Logger logger = LogService.getLogger();

  String msg = this.testName.getMethodName();
  logger.info(LogMarker.GEODE_VERBOSE, msg);

  assertThat(this.systemOutRule.getLog()).contains(msg);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:11,代码来源:GeodeVerboseLogMarkerIntegrationTest.java


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