Cleanup log framework log-levels (set to 'error').

Change default log-level for a Locator to 'warn'.

Add logger configuration for 'org.groups".

Resolves gh-296.
This commit is contained in:
John Blum
2021-09-13 15:54:36 -07:00
parent 2d53c43ee8
commit 244bec0a5b
8 changed files with 31 additions and 33 deletions

View File

@@ -66,7 +66,7 @@ public class LocatorApplicationConfiguration extends AbstractAnnotationConfigSup
public static final int DEFAULT_PORT = 10334;
public static final String DEFAULT_LOG_LEVEL = "config";
public static final String DEFAULT_LOG_LEVEL = "warn";
public static final String DEFAULT_NAME = "SpringBasedLocatorApplication";
protected static final String EXCLUSIVE_LOCATOR_APPLICATION_ERROR_MESSAGE =

View File

@@ -55,6 +55,9 @@ import org.springframework.data.gemfire.util.ArrayUtils;
import org.springframework.util.FileSystemUtils;
import org.springframework.util.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Integration Tests testing the integration of Spring Data for Apache Geode with Apache Geode's new shared, persistent,
* cluster configuration service.
@@ -75,9 +78,11 @@ public class CacheClusterConfigurationIntegrationTests extends ForkingClientServ
private static final List<String> locatorProcessOutput = Collections.synchronizedList(new ArrayList<>());
private static final Logger logger = LoggerFactory.getLogger(CacheClusterConfigurationIntegrationTests.class);
private static ProcessWrapper locatorProcess;
private static final String LOG_LEVEL = "config";
private static final String LOG_LEVEL = "error";
private static final String LOG_FILE = "Locator.log";
@Rule
@@ -86,10 +91,10 @@ public class CacheClusterConfigurationIntegrationTests extends ForkingClientServ
@Override
protected void failed(Throwable throwable, Description description) {
System.err.printf("Test [%s] failed...%n", description.getDisplayName());
System.err.println(ThrowableUtils.toString(throwable));
System.err.println("Locator process log file contents were...");
System.err.println(getLocatorProcessOutput(description));
logger.error("Test [%s] failed...{}", description.getDisplayName());
logger.error(ThrowableUtils.toString(throwable));
logger.error("Locator process log file contents were...");
logger.error(getLocatorProcessOutput(description));
}
@Override
@@ -142,8 +147,8 @@ public class CacheClusterConfigurationIntegrationTests extends ForkingClientServ
List<String> arguments = new ArrayList<>();
arguments.add("-Dgemfire.name=" + locatorName);
arguments.add("-Dlog4j.geode.log.level=info");
arguments.add("-Dlogback.log.level=info");
arguments.add("-Dlog4j.geode.log.level=error");
arguments.add("-Dlogback.log.level=error");
arguments.add("-Dspring.data.gemfire.enable-cluster-configuration=true");
arguments.add("-Dspring.data.gemfire.load-cluster-configuration=true");
arguments.add(String.format("-Dgemfire.log-level=%s", LOG_LEVEL));

View File

@@ -48,6 +48,9 @@ import org.springframework.data.gemfire.util.CollectionUtils;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Integration Tests testing the use of variable {@literal servers} attribute on &lt;gfe:pool/&lt; in SDG XML Namespace
* configuration metadata when connecting a client and server.
@@ -66,6 +69,8 @@ import org.springframework.test.context.junit4.SpringRunner;
@SuppressWarnings("unused")
public class ClientCacheVariableServersIntegrationTests extends ForkingClientServerIntegrationTestsSupport {
private static final Logger logger = LoggerFactory.getLogger(ClientCacheVariableServersIntegrationTests.class);
@BeforeClass
public static void startGeodeServer() throws IOException {
@@ -143,11 +148,9 @@ public class ClientCacheVariableServersIntegrationTests extends ForkingClientSer
CollectionUtils.nullSafeMap(applicationContext.getBeansOfType(CacheServer.class));
for (CacheServer cacheServer : cacheServers.values()) {
System.err.printf("CacheServer host:port [%s:%d]%n",
logger.info("CacheServer host:port [{}:{}]%n",
cacheServer.getBindAddress(), cacheServer.getPort());
}
System.err.flush();
}
}
}

View File

@@ -285,19 +285,14 @@ public class EnableGemFirePropertiesIntegrationTests extends IntegrationTestsSup
assertThat(this.applicationContext.containsBean("gemfireCache")).isTrue();
assertThat(this.applicationContext.containsBean("gemfireProperties")).isTrue();
Properties gemfireProperties = this.applicationContext.getBean("gemfireProperties", Properties.class);
//Properties gemfireProperties = this.applicationContext.getBean("gemfireProperties", Properties.class);
// TODO: uncomment when Spring Test for Apache Geode/Pivotal GemFire project replaces
// the test infrastructure classes in SDG.
/*
GemFireCache gemfireCache = this.applicationContext.getBean("gemfireCache", GemFireCache.class);
assertThat(gemfireCache).isNotNull();
assertThat(gemfireCache.getDistributedSystem()).isNotNull();
Properties gemfireProperties = gemfireCache.getDistributedSystem().getProperties();
*/
assertThat(gemfireProperties).isNotNull();
assertThat(gemfireProperties.containsKey("name")).isTrue();

View File

@@ -18,7 +18,6 @@ package org.springframework.data.gemfire.config.annotation;
import static org.assertj.core.api.Assertions.assertThat;
import java.util.List;
import java.util.Scanner;
import org.junit.AfterClass;
import org.junit.Before;
@@ -30,7 +29,6 @@ import org.apache.geode.cache.Cache;
import org.apache.geode.cache.server.CacheServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.data.gemfire.GemFireProperties;
import org.springframework.data.gemfire.tests.integration.ForkingClientServerIntegrationTestsSupport;
import org.springframework.data.gemfire.tests.process.ProcessWrapper;
@@ -62,17 +60,15 @@ public class PeerCacheApplicationWithAddedCacheServerIntegrationTests
private static ProcessWrapper gemfireLocator;
private static final String GEMFIRE_LOG_LEVEL = "config";
@BeforeClass
public static void startGemFireLocator() throws Exception {
locatorPort = findAvailablePort();
gemfireLocator = run(TestLocatorConfiguration.class,
"-Dspring.data.gemfire.locator.port=" + locatorPort,
String.format("-D%1$s%2$s=%3$s", GemFireProperties.PROPERTY_NAME_PREFIX,
GemFireProperties.ENABLE_CLUSTER_CONFIGURATION.getName(), false));
"-Dspring.data.gemfire.locator.port=" + locatorPort,
String.format("-D%1$s%2$s=%3$s", GemFireProperties.PROPERTY_NAME_PREFIX,
GemFireProperties.ENABLE_CLUSTER_CONFIGURATION.getName(), false));
waitForServerToStart("localhost", locatorPort);
@@ -117,17 +113,12 @@ public class PeerCacheApplicationWithAddedCacheServerIntegrationTests
assertThat(cacheServer.getPort()).isEqualTo(cacheServerPort);
}
@LocatorApplication(logLevel = GEMFIRE_LOG_LEVEL)
@LocatorApplication
static class TestLocatorConfiguration {
public static void main(String[] args) {
AnnotationConfigApplicationContext applicationContext =
new AnnotationConfigApplicationContext(TestLocatorConfiguration.class);
applicationContext.registerShutdownHook();
new Scanner(System.in).nextLine();
runSpringApplication(TestLocatorConfiguration.class);
block();
}
}

View File

@@ -1,6 +1,7 @@
# java.util.logging (JUL) configuration
org.apache=ERROR
org.jgroups=ERROR
org.springframework=ERROR
org.springframework.data.gemfire.listener.adapter.ContinuousQueryListenerAdapter=OFF
org.springframework.data.gemfire.listener.adapter.ContinuousQueryListenerAdapter.useParentHandlers=false

View File

@@ -10,6 +10,7 @@
</Appenders>
<Loggers>
<Logger name="org.apache.geode" level="${sys:log4j.geode.log.level:-error}"/>
<Logger name="org.jgroups" level="${sys:log4j.geode.log.level:-error}"/>
<Logger name="org.springframework" level="${sys:log4j.spring.log.level:-error}"/>
<Logger name="org.springframework.data.gemfire.listener.adapter.ContinuousQueryListenerAdapter" level="off" additivity="false"/>
<Logger name="org.springframework.data.gemfire.support.SpringContextBootstrappingInitializer" level="off" additivity="false"/>

View File

@@ -21,11 +21,13 @@
<logger name="org.apache.geode" level="${logback.log.level:-ERROR}"/>
<logger name="org.jgroups" level="${logback.log.level:-ERROR}"/>
<logger name="org.springframework" level="${logback.log.level:-ERROR}"/>
<logger name="org.springframework.data" level="${logback.log.level:-ERROR}"/>
<logger name="org.springframework.data.gemfire" level="${logback.log.level:-CONFIG}"/>
<logger name="org.springframework.data.gemfire" level="${logback.log.level:-ERROR}"/>
<logger name="org.springframework.data.gemfire.config.annotation.support.RegionDataAccessTracingAspect" level="trace" additivity="false">
<appender-ref ref="testAppender"/>