本文整理汇总了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;
}
示例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;
}
示例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()));
}
}
}
}
示例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();
}
示例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();
}
示例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));
}
示例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();
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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();
}
}
示例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());
}
}
示例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);
}
示例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);
}
示例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);
}