diff --git a/boms/geode-all-bom/src/test/resources/expected-pom.xml b/boms/geode-all-bom/src/test/resources/expected-pom.xml
index c7a6adb26251..f5ca0b794bf4 100644
--- a/boms/geode-all-bom/src/test/resources/expected-pom.xml
+++ b/boms/geode-all-bom/src/test/resources/expected-pom.xml
@@ -835,6 +835,12 @@
1.11.0-SNAPSHOT
compile
+
+ org.apache.geode
+ geode-logging
+ 1.11.0-SNAPSHOT
+ compile
+
org.apache.geode
geode-lucene
diff --git a/extensions/geode-modules-assembly/release/session/bin/modify_war b/extensions/geode-modules-assembly/release/session/bin/modify_war
index f7f632b40b7e..564a5fd88e30 100755
--- a/extensions/geode-modules-assembly/release/session/bin/modify_war
+++ b/extensions/geode-modules-assembly/release/session/bin/modify_war
@@ -262,6 +262,7 @@ SESSION_JAR="${LIB_DIR}/geode-modules-session-${VERSION}.jar"
declare -a OTHER_JARS
OTHER_JARS=(${GEODE}/lib/geode-core-${VERSION}.jar \
+ ${GEODE}/lib/geode-logging-${VERSION}.jar \
${GEODE}/lib/geode-serialization-${VERSION}.jar \
${GEODE}/lib/geode-common-${VERSION}.jar \
${GEODE}/lib/geode-log4j-${VERSION}.jar \
diff --git a/extensions/geode-modules-session-internal/build.gradle b/extensions/geode-modules-session-internal/build.gradle
index deca2858fb1a..02bfdf6b4033 100644
--- a/extensions/geode-modules-session-internal/build.gradle
+++ b/extensions/geode-modules-session-internal/build.gradle
@@ -25,6 +25,7 @@ dependencies {
compile(platform(project(':boms:geode-all-bom')))
compile(project(':extensions:geode-modules'))
compile(project(':geode-core'))
+ implementation(project(':geode-logging'))
compile('javax.servlet:javax.servlet-api')
compile('mx4j:mx4j')
diff --git a/extensions/geode-modules-session/build.gradle b/extensions/geode-modules-session/build.gradle
index 67f482161241..951e9ae149ce 100644
--- a/extensions/geode-modules-session/build.gradle
+++ b/extensions/geode-modules-session/build.gradle
@@ -33,6 +33,7 @@ dependencies {
integrationTestCompile(project(':geode-dunit')) {
exclude module: 'geode-core'
}
+ integrationTestImplementation(project(':geode-logging'))
compile('javax.servlet:javax.servlet-api')
compile('org.apache.tomcat:servlet-api:' + DependencyConstraints.get('tomcat6.version'))
diff --git a/extensions/geode-modules-test/build.gradle b/extensions/geode-modules-test/build.gradle
index e992e6465c67..6d9fef3e8f9f 100644
--- a/extensions/geode-modules-test/build.gradle
+++ b/extensions/geode-modules-test/build.gradle
@@ -28,6 +28,8 @@ dependencies {
exclude group: 'org.apache.tomcat'
}
compile(project(':geode-core'))
+ implementation(project(':geode-logging'))
+
compile(project(':geode-junit')) {
exclude module: 'geode-core'
}
diff --git a/extensions/geode-modules-tomcat8/build.gradle b/extensions/geode-modules-tomcat8/build.gradle
index f6d62b8dafb2..f8c7730f5a81 100644
--- a/extensions/geode-modules-tomcat8/build.gradle
+++ b/extensions/geode-modules-tomcat8/build.gradle
@@ -27,6 +27,7 @@ dependencies {
compile(platform(project(':boms:geode-all-bom')))
distributedTestCompile('junit:junit')
compile('mx4j:mx4j')
+ distributedTestImplementation(project(':geode-logging'))
distributedTestCompile('org.httpunit:httpunit')
distributedTestCompile('org.apache.tomcat:tomcat-jaspic-api:' + DependencyConstraints.get('tomcat8.version'))
compile(project(':geode-core'))
diff --git a/extensions/geode-modules/build.gradle b/extensions/geode-modules/build.gradle
index f7b48ad2dd10..238521dc836d 100644
--- a/extensions/geode-modules/build.gradle
+++ b/extensions/geode-modules/build.gradle
@@ -25,6 +25,7 @@ evaluationDependsOn(":geode-core")
dependencies {
compile(platform(project(':boms:geode-all-bom')))
+ implementation(project(':geode-logging'))
implementation(project(':geode-serialization'))
compile(project(':geode-core'))
integrationTestCompile(project(':extensions:geode-modules-test')) {
diff --git a/geode-assembly/build.gradle b/geode-assembly/build.gradle
index 62dc84a11d37..091954103530 100755
--- a/geode-assembly/build.gradle
+++ b/geode-assembly/build.gradle
@@ -33,6 +33,7 @@ def dependentProjectNames = [
':geode-core',
':geode-cq',
':geode-log4j',
+ ':geode-logging',
':geode-lucene',
':geode-memcached',
':geode-old-client-support',
@@ -162,6 +163,7 @@ dependencies {
geodeArchives project(':geode-core')
geodeArchives project(':geode-cq')
geodeArchives project(':geode-log4j')
+ geodeArchives project(':geode-logging')
geodeArchives project(':geode-lucene')
geodeArchives project(':geode-management')
geodeArchives project(':geode-memcached')
@@ -211,11 +213,13 @@ dependencies {
integrationTestCompile(project(':geode-assembly:geode-assembly-test'))
integrationTestCompile('org.apache.httpcomponents:httpclient')
integrationTestCompile('javax.annotation:javax.annotation-api')
+ integrationTestImplementation(project(':geode-logging'))
integrationTestRuntime('io.swagger:swagger-annotations')
+ distributedTestImplementation(project(':geode-logging'))
distributedTestImplementation(project(':geode-serialization'))
distributedTestCompile(project(':geode-core'))
distributedTestCompile(project(':geode-log4j')) {
@@ -269,7 +273,7 @@ dependencies {
uiTestRuntime(project(':geode-core'))
uiTestRuntime('org.seleniumhq.selenium:selenium-chrome-driver')
-
+ upgradeTestImplementation project(':geode-logging')
upgradeTestImplementation project(':geode-serialization')
upgradeTestCompile(project(':geode-core'))
upgradeTestCompile(project(':geode-dunit')) {
diff --git a/geode-assembly/geode-assembly-test/build.gradle b/geode-assembly/geode-assembly-test/build.gradle
index aa02bb039248..afb1ac0e7e02 100755
--- a/geode-assembly/geode-assembly-test/build.gradle
+++ b/geode-assembly/geode-assembly-test/build.gradle
@@ -25,6 +25,7 @@ dependencies {
compileOnly(project(':extensions:geode-modules-test'))
compileOnly(project(':geode-core'))
compileOnly(project(':geode-pulse'))
+ implementation(project(':geode-logging'))
compileOnly('com.fasterxml.jackson.core:jackson-databind')
compileOnly('commons-io:commons-io')
compileOnly('junit:junit')
diff --git a/geode-assembly/geode-assembly-test/src/main/java/org/apache/geode/session/tests/TomcatInstall.java b/geode-assembly/geode-assembly-test/src/main/java/org/apache/geode/session/tests/TomcatInstall.java
index 825d86c010ec..1a1d555adb83 100644
--- a/geode-assembly/geode-assembly-test/src/main/java/org/apache/geode/session/tests/TomcatInstall.java
+++ b/geode-assembly/geode-assembly-test/src/main/java/org/apache/geode/session/tests/TomcatInstall.java
@@ -97,7 +97,7 @@ public String jarSkipPropertyName() {
*/
private static final String[] tomcatRequiredJars =
{"antlr", "commons-io", "commons-lang", "commons-validator", "fastutil", "geode-common",
- "geode-core", "geode-log4j", "geode-management", "geode-serialization",
+ "geode-core", "geode-log4j", "geode-logging", "geode-management", "geode-serialization",
"javax.transaction-api", "jgroups", "log4j-api", "log4j-core", "log4j-jul", "micrometer",
"shiro-core", "jetty-server", "jetty-util", "jetty-http", "jetty-io"};
diff --git a/geode-assembly/src/integrationTest/resources/assembly_content.txt b/geode-assembly/src/integrationTest/resources/assembly_content.txt
index a22e8b5e8604..a10c25ae96dc 100644
--- a/geode-assembly/src/integrationTest/resources/assembly_content.txt
+++ b/geode-assembly/src/integrationTest/resources/assembly_content.txt
@@ -959,6 +959,7 @@ lib/geode-dependencies.jar
lib/geode-http-service-0.0.0.jar
lib/geode-jca-0.0.0.rar
lib/geode-log4j-0.0.0.jar
+lib/geode-logging-0.0.0.jar
lib/geode-lucene-0.0.0.jar
lib/geode-management-0.0.0.jar
lib/geode-memcached-0.0.0.jar
diff --git a/geode-assembly/src/integrationTest/resources/dependency_classpath.txt b/geode-assembly/src/integrationTest/resources/dependency_classpath.txt
index c64d1e8242b8..1db9297715f8 100644
--- a/geode-assembly/src/integrationTest/resources/dependency_classpath.txt
+++ b/geode-assembly/src/integrationTest/resources/dependency_classpath.txt
@@ -4,6 +4,7 @@ geode-core-0.0.0.jar
geode-cq-0.0.0.jar
geode-http-service-0.0.0.jar
geode-log4j-0.0.0.jar
+geode-logging-0.0.0.jar
geode-lucene-0.0.0.jar
geode-management-0.0.0.jar
geode-memcached-0.0.0.jar
diff --git a/geode-connectors/build.gradle b/geode-connectors/build.gradle
index 863f4341f3ac..384fa3dc24da 100644
--- a/geode-connectors/build.gradle
+++ b/geode-connectors/build.gradle
@@ -48,6 +48,7 @@ task downloadJdbcJars(type:Copy) {
dependencies {
compile(platform(project(':boms:geode-all-bom')))
+ implementation(project(':geode-logging'))
implementation(project(':geode-serialization'))
compile(project(':geode-core'))
testCompile(project(':geode-junit')) {
diff --git a/geode-connectors/src/test/resources/expected-pom.xml b/geode-connectors/src/test/resources/expected-pom.xml
index da06b0e36dbb..2d106582bc64 100644
--- a/geode-connectors/src/test/resources/expected-pom.xml
+++ b/geode-connectors/src/test/resources/expected-pom.xml
@@ -118,6 +118,11 @@
rmiio
compile
+
+ org.apache.geode
+ geode-logging
+ runtime
+
org.apache.geode
geode-serialization
diff --git a/geode-core/build.gradle b/geode-core/build.gradle
index 15ef289ddc50..cb32f25eebfe 100755
--- a/geode-core/build.gradle
+++ b/geode-core/build.gradle
@@ -310,6 +310,7 @@ dependencies {
//Geode-common has annotations and other pieces used geode-core
api(project(':geode-common'))
+ implementation(project(':geode-logging'))
implementation(project(':geode-unsafe'))
implementation(project(':geode-serialization'))
diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/PoolImpl.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/PoolImpl.java
index 8c516199a60b..3dbd99fd0c11 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/PoolImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/PoolImpl.java
@@ -60,9 +60,9 @@
import org.apache.geode.internal.cache.PoolManagerImpl;
import org.apache.geode.internal.cache.PoolStats;
import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
+import org.apache.geode.internal.logging.CoreLoggingExecutors;
import org.apache.geode.internal.logging.InternalLogWriter;
import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.LoggingExecutors;
import org.apache.geode.internal.monitoring.ThreadsMonitoring;
import org.apache.geode.internal.statistics.DummyStatisticsFactory;
@@ -320,7 +320,7 @@ private void start() {
}
final String timerName = "poolTimer-" + getName() + "-";
- backgroundProcessor = LoggingExecutors.newScheduledThreadPool(timerName,
+ backgroundProcessor = CoreLoggingExecutors.newScheduledThreadPool(timerName,
BACKGROUND_TASK_POOL_SIZE, BACKGROUND_TASK_POOL_KEEP_ALIVE, threadMonitoring);
source.start(this);
connectionFactory.start(backgroundProcessor);
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterOperationExecutors.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterOperationExecutors.java
index 7414d81eec11..ce0552ffce33 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterOperationExecutors.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/ClusterOperationExecutors.java
@@ -33,8 +33,8 @@
import org.apache.geode.SystemFailure;
import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
import org.apache.geode.distributed.internal.membership.gms.messages.ViewAckMessage;
+import org.apache.geode.internal.logging.CoreLoggingExecutors;
import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.LoggingExecutors;
import org.apache.geode.internal.logging.log4j.LogMarker;
import org.apache.geode.internal.monitoring.ThreadsMonitoring;
import org.apache.geode.internal.monitoring.ThreadsMonitoringImpl;
@@ -220,7 +220,7 @@ public class ClusterOperationExecutors implements OperationExecutors {
stats.getSerialQueueHelper());
poolQueue = serialQueue;
}
- serialThread = LoggingExecutors.newSerialThreadPool("Serial Message Processor",
+ serialThread = CoreLoggingExecutors.newSerialThreadPool("Serial Message Processor",
thread -> stats.incSerialThreadStarts(),
this::doSerialThread, stats.getSerialProcessorHelper(),
threadMonitor, poolQueue);
@@ -228,17 +228,17 @@ public class ClusterOperationExecutors implements OperationExecutors {
}
viewThread =
- LoggingExecutors.newSerialThreadPoolWithUnlimitedFeed("View Message Processor",
+ CoreLoggingExecutors.newSerialThreadPoolWithUnlimitedFeed("View Message Processor",
thread -> stats.incViewThreadStarts(), this::doViewThread,
stats.getViewProcessorHelper(), threadMonitor);
threadPool =
- LoggingExecutors.newThreadPoolWithFeedStatistics("Pooled Message Processor ",
+ CoreLoggingExecutors.newThreadPoolWithFeedStatistics("Pooled Message Processor ",
thread -> stats.incProcessingThreadStarts(), this::doProcessingThread,
MAX_THREADS, stats.getNormalPoolHelper(), threadMonitor,
INCOMING_QUEUE_LIMIT, stats.getOverflowQueueHelper());
- highPriorityPool = LoggingExecutors.newThreadPoolWithFeedStatistics(
+ highPriorityPool = CoreLoggingExecutors.newThreadPoolWithFeedStatistics(
"Pooled High Priority Message Processor ",
thread -> stats.incHighPriorityThreadStarts(), this::doHighPriorityThread,
MAX_THREADS, stats.getHighPriorityPoolHelper(), threadMonitor,
@@ -252,26 +252,28 @@ public class ClusterOperationExecutors implements OperationExecutors {
} else {
poolQueue = new OverflowQueueWithDMStats<>(stats.getWaitingQueueHelper());
}
- waitingPool = LoggingExecutors.newThreadPool("Pooled Waiting Message Processor ",
+ waitingPool = CoreLoggingExecutors.newThreadPool("Pooled Waiting Message Processor ",
thread -> stats.incWaitingThreadStarts(), this::doWaitingThread,
MAX_WAITING_THREADS, stats.getWaitingPoolHelper(), threadMonitor, poolQueue);
}
// should this pool using the waiting pool stats?
prMetaDataCleanupThreadPool =
- LoggingExecutors.newThreadPoolWithFeedStatistics("PrMetaData cleanup Message Processor ",
+ CoreLoggingExecutors.newThreadPoolWithFeedStatistics(
+ "PrMetaData cleanup Message Processor ",
thread -> stats.incWaitingThreadStarts(), this::doWaitingThread,
MAX_PR_META_DATA_CLEANUP_THREADS, stats.getWaitingPoolHelper(), threadMonitor,
0, stats.getWaitingQueueHelper());
if (MAX_PR_THREADS > 1) {
partitionedRegionPool =
- LoggingExecutors.newThreadPoolWithFeedStatistics("PartitionedRegion Message Processor",
+ CoreLoggingExecutors.newThreadPoolWithFeedStatistics(
+ "PartitionedRegion Message Processor",
thread -> stats.incPartitionedRegionThreadStarts(), this::doPartitionRegionThread,
MAX_PR_THREADS, stats.getPartitionedRegionPoolHelper(), threadMonitor,
INCOMING_QUEUE_LIMIT, stats.getPartitionedRegionQueueHelper());
} else {
- partitionedRegionThread = LoggingExecutors.newSerialThreadPoolWithFeedStatistics(
+ partitionedRegionThread = CoreLoggingExecutors.newSerialThreadPoolWithFeedStatistics(
"PartitionedRegion Message Processor",
thread -> stats.incPartitionedRegionThreadStarts(), this::doPartitionRegionThread,
stats.getPartitionedRegionPoolHelper(), threadMonitor,
@@ -279,14 +281,14 @@ public class ClusterOperationExecutors implements OperationExecutors {
}
if (MAX_FE_THREADS > 1) {
functionExecutionPool =
- LoggingExecutors.newFunctionThreadPoolWithFeedStatistics(
+ CoreLoggingExecutors.newFunctionThreadPoolWithFeedStatistics(
FUNCTION_EXECUTION_PROCESSOR_THREAD_PREFIX,
thread -> stats.incFunctionExecutionThreadStarts(), this::doFunctionExecutionThread,
MAX_FE_THREADS, stats.getFunctionExecutionPoolHelper(), threadMonitor,
INCOMING_QUEUE_LIMIT, stats.getFunctionExecutionQueueHelper());
} else {
functionExecutionThread =
- LoggingExecutors.newSerialThreadPoolWithFeedStatistics(
+ CoreLoggingExecutors.newSerialThreadPoolWithFeedStatistics(
FUNCTION_EXECUTION_PROCESSOR_THREAD_PREFIX,
thread -> stats.incFunctionExecutionThreadStarts(), this::doFunctionExecutionThread,
stats.getFunctionExecutionPoolHelper(), threadMonitor,
@@ -847,7 +849,7 @@ private ExecutorService createSerialExecutor(final Integer id) {
serialQueuedMap.put(id, poolQueue);
- return LoggingExecutors.newSerialThreadPool("Pooled Serial Message Processor" + id + "-",
+ return CoreLoggingExecutors.newSerialThreadPool("Pooled Serial Message Processor" + id + "-",
thread -> stats.incSerialPooledThreadStarts(), this::doSerialPooledThread,
stats.getSerialPooledProcessorHelper(), threadMonitoring, poolQueue);
}
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
index 821a50870aed..ec0253ce62d9 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalDistributedSystem.java
@@ -101,6 +101,7 @@
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.LogWriterFactory;
import org.apache.geode.internal.logging.LoggingThread;
+import org.apache.geode.internal.logging.LoggingUncaughtExceptionHandler;
import org.apache.geode.internal.net.SocketCreatorFactory;
import org.apache.geode.internal.offheap.MemoryAllocator;
import org.apache.geode.internal.offheap.OffHeapStorage;
@@ -537,6 +538,8 @@ private InternalDistributedSystem(ConnectionConfig config,
StatisticsManagerFactory statisticsManagerFactory) {
alertingSession = AlertingSession.create();
alertingService = new InternalAlertingServiceFactory().create();
+ LoggingUncaughtExceptionHandler
+ .setFailureSetter(error -> SystemFailure.setFailure((VirtualMachineError) error));
loggingSession = LoggingSession.create();
originalConfig = config.distributionConfig();
isReconnectingDS = config.isReconnecting();
@@ -2186,7 +2189,7 @@ public Properties getSecurityProperties() {
// .uncleanShutdown("VM is exiting", null);
// }
}
- });
+ }, false);
Runtime.getRuntime().addShutdownHook(tmp_shutdownHook);
}
} finally {
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpServer.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpServer.java
index 6c12a1ce471a..dbf371e5f6cb 100755
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpServer.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/tcpserver/TcpServer.java
@@ -60,8 +60,8 @@
import org.apache.geode.internal.cache.client.protocol.exception.ServiceVersionNotFoundException;
import org.apache.geode.internal.cache.tier.CommunicationMode;
import org.apache.geode.internal.cache.tier.sockets.Handshake;
+import org.apache.geode.internal.logging.CoreLoggingExecutors;
import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.LoggingExecutors;
import org.apache.geode.internal.logging.LoggingThread;
import org.apache.geode.internal.net.SocketCreator;
import org.apache.geode.internal.net.SocketCreatorFactory;
@@ -187,7 +187,7 @@ protected SocketCreator getSocketCreator() {
}
private static ExecutorService createExecutor(PoolStatHelper poolHelper) {
- return LoggingExecutors.newThreadPoolWithSynchronousFeed("locator request thread ",
+ return CoreLoggingExecutors.newThreadPoolWithSynchronousFeed("locator request thread ",
MAX_POOL_SIZE, poolHelper, POOL_IDLE_TIMEOUT, new ThreadPoolExecutor.CallerRunsPolicy());
}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
index a33edb9bfbae..3cbe06ee6bc8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/AbstractRegion.java
@@ -94,6 +94,7 @@
import org.apache.geode.internal.cache.extension.SimpleExtensionPoint;
import org.apache.geode.internal.cache.snapshot.RegionSnapshotServiceImpl;
import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.logging.LogWithToString;
import org.apache.geode.internal.serialization.DataSerializableFixedID;
import org.apache.geode.internal.serialization.DeserializationContext;
import org.apache.geode.internal.serialization.SerializationContext;
@@ -106,7 +107,7 @@
*/
@SuppressWarnings("deprecation")
public abstract class AbstractRegion implements InternalRegion, AttributesMutator, CacheStatistics,
- DataSerializableFixedID, Extensible>, EvictableRegion {
+ DataSerializableFixedID, Extensible>, EvictableRegion, LogWithToString {
private static final Logger logger = LogService.getLogger();
private final ReentrantReadWriteLock readWriteLockForCacheLoader = new ReentrantReadWriteLock();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/EntriesSet.java b/geode-core/src/main/java/org/apache/geode/internal/cache/EntriesSet.java
index 18e3a3e27521..dd7eaaf4faba 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/EntriesSet.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/EntriesSet.java
@@ -26,9 +26,10 @@
import org.apache.geode.cache.Region;
import org.apache.geode.internal.cache.LocalRegion.IteratorType;
import org.apache.geode.internal.cache.entries.AbstractRegionEntry;
+import org.apache.geode.internal.logging.LogWithToString;
/** Set view of entries */
-public class EntriesSet extends AbstractSet implements EntriesCollection {
+public class EntriesSet extends AbstractSet implements LogWithToString {
final LocalRegion topRegion;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java b/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
index 87b66f01296d..25304299d8da 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/ExpiryTask.java
@@ -32,8 +32,8 @@
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.internal.SystemTimer;
+import org.apache.geode.internal.logging.CoreLoggingExecutors;
import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.LoggingExecutors;
import org.apache.geode.internal.tcp.ConnectionTable;
/**
@@ -52,7 +52,7 @@ public abstract class ExpiryTask extends SystemTimer.SystemTimerTask {
// default to inline expiry to fix bug 37115
int nThreads = Integer.getInteger(DistributionConfig.GEMFIRE_PREFIX + "EXPIRY_THREADS", 0);
if (nThreads > 0) {
- executor = LoggingExecutors.newThreadPoolWithSynchronousFeed("Expiry ",
+ executor = CoreLoggingExecutors.newThreadPoolWithSynchronousFeed("Expiry ",
(Runnable command) -> doExpiryThread(command),
nThreads);
} else {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index cb03176d7d1e..105e0452734a 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -217,6 +217,7 @@
import org.apache.geode.internal.jndi.JNDIInvoker;
import org.apache.geode.internal.jta.TransactionManagerImpl;
import org.apache.geode.internal.lang.ThrowableUtils;
+import org.apache.geode.internal.logging.CoreLoggingExecutors;
import org.apache.geode.internal.logging.InternalLogWriter;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.LoggingExecutors;
@@ -855,7 +856,7 @@ public static GemFireCacheImpl getForPdx(String reason) {
persistentMemberManager = new PersistentMemberManager();
if (useAsyncEventListeners) {
- eventThreadPool = LoggingExecutors.newThreadPoolWithFixedFeed("Message Event Thread",
+ eventThreadPool = CoreLoggingExecutors.newThreadPoolWithFixedFeed("Message Event Thread",
command -> {
ConnectionTable.threadWantsSharedResources();
command.run();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/control/InternalResourceManager.java b/geode-core/src/main/java/org/apache/geode/internal/cache/control/InternalResourceManager.java
index a4a39a2516cc..7284d7e80ace 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/control/InternalResourceManager.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/control/InternalResourceManager.java
@@ -52,6 +52,7 @@
import org.apache.geode.internal.cache.control.ResourceAdvisor.ResourceManagerProfile;
import org.apache.geode.internal.cache.partitioned.LoadProbe;
import org.apache.geode.internal.cache.partitioned.SizedBasedLoadProbe;
+import org.apache.geode.internal.logging.CoreLoggingExecutors;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.LoggingExecutors;
import org.apache.geode.internal.monitoring.ThreadsMonitoring;
@@ -135,7 +136,7 @@ private InternalResourceManager(InternalCache cache) {
// Create a new executor the resource manager and the monitors it creates
// can use to handle dispatching of notifications.
this.notifyExecutor =
- LoggingExecutors.newSerialThreadPoolWithFeedStatistics("Notification Handler",
+ CoreLoggingExecutors.newSerialThreadPoolWithFeedStatistics("Notification Handler",
thread -> thread.setPriority(Thread.MAX_PRIORITY), null,
this.stats.getResourceEventPoolStatHelper(), getThreadMonitorObj(),
0, this.stats.getResourceEventQueueStatHelper());
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/eviction/HeapEvictor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/eviction/HeapEvictor.java
index 5b350b693b35..e44b9803a1c8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/eviction/HeapEvictor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/eviction/HeapEvictor.java
@@ -40,8 +40,8 @@
import org.apache.geode.internal.cache.control.InternalResourceManager.ResourceType;
import org.apache.geode.internal.cache.control.MemoryEvent;
import org.apache.geode.internal.cache.control.ResourceListener;
+import org.apache.geode.internal.logging.CoreLoggingExecutors;
import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.LoggingExecutors;
import org.apache.geode.internal.statistics.StatisticsClock;
/**
@@ -115,7 +115,7 @@ public HeapEvictor(final InternalCache cache, final String threadName,
if (!DISABLE_HEAP_EVICTOR_THREAD_POOL) {
QueueStatHelper poolStats = this.cache.getCachePerfStats().getEvictionQueueStatHelper();
- this.evictorThreadPool = LoggingExecutors.newFixedThreadPoolWithTimeout(threadName,
+ this.evictorThreadPool = CoreLoggingExecutors.newFixedThreadPoolWithTimeout(threadName,
MAX_EVICTOR_THREADS, 15, poolStats);
} else {
// disabled
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java
index 6242e9cbbdd5..36002fcb0161 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/AcceptorImpl.java
@@ -89,8 +89,8 @@
import org.apache.geode.internal.cache.tier.sockets.CacheClientNotifier.CacheClientNotifierProvider;
import org.apache.geode.internal.cache.tier.sockets.ClientHealthMonitor.ClientHealthMonitorProvider;
import org.apache.geode.internal.cache.wan.GatewayReceiverStats;
+import org.apache.geode.internal.logging.CoreLoggingExecutors;
import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.LoggingExecutors;
import org.apache.geode.internal.logging.LoggingThread;
import org.apache.geode.internal.logging.LoggingThreadFactory.CommandWrapper;
import org.apache.geode.internal.logging.LoggingThreadFactory.ThreadInitializer;
@@ -645,7 +645,7 @@ private ExecutorService initializeHandshakerThreadPool() throws IOException {
"Handshaker " + serverSock.getInetAddress() + ":" + localPort + " Thread ";
try {
logger.warn("Handshaker max Pool size: " + HANDSHAKE_POOL_SIZE);
- return LoggingExecutors.newThreadPoolWithSynchronousFeedThatHandlesRejection(threadName,
+ return CoreLoggingExecutors.newThreadPoolWithSynchronousFeedThatHandlesRejection(threadName,
thread -> getStats().incAcceptThreadsCreated(), null, 1, HANDSHAKE_POOL_SIZE, 60);
} catch (IllegalArgumentException poolInitException) {
stats.close();
@@ -656,7 +656,8 @@ private ExecutorService initializeHandshakerThreadPool() throws IOException {
}
private ExecutorService initializeClientQueueInitializerThreadPool() {
- return LoggingExecutors.newThreadPoolWithSynchronousFeed("Client Queue Initialization Thread ",
+ return CoreLoggingExecutors.newThreadPoolWithSynchronousFeed(
+ "Client Queue Initialization Thread ",
command -> {
try {
command.run();
@@ -681,11 +682,11 @@ private ExecutorService initializeServerConnectionThreadPool() throws IOExceptio
try {
String threadName = "ServerConnection on port " + localPort + " Thread ";
if (isSelector()) {
- return LoggingExecutors.newThreadPoolWithUnlimitedFeed(threadName, threadInitializer,
+ return CoreLoggingExecutors.newThreadPoolWithUnlimitedFeed(threadName, threadInitializer,
commandWrapper, maxThreads,
getStats().getCnxPoolHelper(), Integer.MAX_VALUE, getThreadMonitorObj());
}
- return LoggingExecutors.newThreadPoolWithSynchronousFeed(threadName, threadInitializer,
+ return CoreLoggingExecutors.newThreadPoolWithSynchronousFeed(threadName, threadInitializer,
commandWrapper,
MINIMUM_MAX_CONNECTIONS, maxConnections, 0L);
} catch (IllegalArgumentException poolInitException) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/logging/LoggingExecutors.java b/geode-core/src/main/java/org/apache/geode/internal/logging/CoreLoggingExecutors.java
similarity index 72%
rename from geode-core/src/main/java/org/apache/geode/internal/logging/LoggingExecutors.java
rename to geode-core/src/main/java/org/apache/geode/internal/logging/CoreLoggingExecutors.java
index 456e11897fbf..d0a04b1341d8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/logging/LoggingExecutors.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/logging/CoreLoggingExecutors.java
@@ -19,20 +19,14 @@
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
-import java.util.concurrent.ForkJoinPool;
-import java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory;
-import java.util.concurrent.ForkJoinWorkerThread;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.RejectedExecutionHandler;
import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
import org.apache.geode.distributed.internal.FunctionExecutionPooledExecutor;
import org.apache.geode.distributed.internal.OverflowQueueWithDMStats;
@@ -49,7 +43,7 @@
* Utility class that creates instances of ExecutorService
* whose threads will always log uncaught exceptions.
*/
-public class LoggingExecutors {
+public class CoreLoggingExecutors {
public static ExecutorService newSerialThreadPool(String threadName,
ThreadInitializer threadInitializer, CommandWrapper commandWrapper,
@@ -201,90 +195,10 @@ public static ExecutorService newThreadPoolWithSynchronousFeedThatHandlesRejecti
threadFactory, rejectedExecutionHandler);
}
- private static ThreadPoolExecutor newFixedThreadPool(String threadName, boolean isDaemon,
- int poolSize, long keepAliveSeconds, BlockingQueue feed) {
- ThreadFactory threadFactory = new LoggingThreadFactory(threadName, isDaemon);
- return new ThreadPoolExecutor(poolSize, poolSize,
- keepAliveSeconds, SECONDS,
- feed, threadFactory);
- }
-
- private static ThreadPoolExecutor newFixedThreadPool(String threadName, boolean isDaemon,
- long keepAliveSeconds, int poolSize) {
- LinkedBlockingQueue feed = new LinkedBlockingQueue<>();
- return newFixedThreadPool(threadName, isDaemon, poolSize, keepAliveSeconds, feed);
- }
-
- public static ExecutorService newFixedThreadPool(String threadName, boolean isDaemon,
- int poolSize) {
- return newFixedThreadPool(threadName, isDaemon, 0L, poolSize);
- }
-
- public static ExecutorService newFixedThreadPoolWithTimeout(String threadName, int poolSize,
- int keepAliveSeconds) {
- return newFixedThreadPool(threadName, true, keepAliveSeconds, poolSize);
- }
-
public static ExecutorService newFixedThreadPoolWithTimeout(String threadName,
int poolSize, int keepAliveSeconds, QueueStatHelper feedStats) {
BlockingQueue feed = createFeedWithStatistics(0, feedStats);
- return newFixedThreadPool(threadName, true, poolSize, keepAliveSeconds, feed);
- }
-
- public static ExecutorService newFixedThreadPoolWithFeedSize(String threadName,
- int poolSize, int feedSize) {
- LinkedBlockingQueue feed = new LinkedBlockingQueue<>(feedSize);
- RejectedExecutionHandler rejectionHandler = new ThreadPoolExecutor.CallerRunsPolicy();
- ThreadFactory threadFactory = new LoggingThreadFactory(threadName);
- ThreadPoolExecutor executor = new ThreadPoolExecutor(poolSize, poolSize, 10, SECONDS, feed,
- threadFactory, rejectionHandler);
- executor.allowCoreThreadTimeOut(true);
- return executor;
- }
-
- public static ExecutorService newSingleThreadExecutor(String threadName, boolean isDaemon) {
- ThreadFactory threadFactory = new LoggingThreadFactory(threadName, isDaemon);
- return new ThreadPoolExecutor(1, 1, 0L, SECONDS,
- new LinkedBlockingQueue(),
- threadFactory);
- }
-
- public static ExecutorService newCachedThreadPool(String threadName, boolean isDaemon) {
- ThreadFactory threadFactory = new LoggingThreadFactory(threadName, isDaemon);
- return new ThreadPoolExecutor(0, Integer.MAX_VALUE,
- 60L, TimeUnit.SECONDS,
- new SynchronousQueue(),
- threadFactory);
- }
-
- public static ExecutorService newWorkStealingPool(String threadName, int maxParallelThreads) {
- final ForkJoinWorkerThreadFactory factory = pool -> {
- ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool);
- LoggingUncaughtExceptionHandler.setOnThread(worker);
- worker.setName(threadName + worker.getPoolIndex());
- return worker;
- };
- return new ForkJoinPool(maxParallelThreads, factory, null, true);
- }
-
- public static Executor newThreadOnEachExecute(String threadName) {
- return command -> new LoggingThread(threadName, command).start();
- }
-
- public static ScheduledExecutorService newScheduledThreadPool(String threadName, int poolSize) {
- return newScheduledThreadPool(threadName, poolSize, true);
- }
-
- public static ScheduledExecutorService newScheduledThreadPool(String threadName, int poolSize,
- boolean executeDelayedTasks) {
- ScheduledThreadPoolExecutor result =
- new ScheduledThreadPoolExecutor(poolSize, new LoggingThreadFactory(threadName));
- result.setExecuteExistingDelayedTasksAfterShutdownPolicy(executeDelayedTasks);
- return result;
- }
-
- public static ScheduledExecutorService newSingleThreadScheduledExecutor(String threadName) {
- return newScheduledThreadPool(threadName, 1);
+ return LoggingExecutors.newFixedThreadPool(threadName, true, poolSize, keepAliveSeconds, feed);
}
public static ScheduledExecutorService newScheduledThreadPool(String threadName, int poolSize,
@@ -298,7 +212,7 @@ keepAliveMillis, MILLISECONDS, new LoggingThreadFactory(threadName),
return result;
}
- private LoggingExecutors() {
+ private CoreLoggingExecutors() {
// no instances allowed
}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/tcp/ConnectionTable.java b/geode-core/src/main/java/org/apache/geode/internal/tcp/ConnectionTable.java
index b622079bf1f6..4331f2565be5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/tcp/ConnectionTable.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/tcp/ConnectionTable.java
@@ -47,6 +47,7 @@
import org.apache.geode.distributed.internal.membership.gms.api.Membership;
import org.apache.geode.internal.Assert;
import org.apache.geode.internal.SystemTimer;
+import org.apache.geode.internal.logging.CoreLoggingExecutors;
import org.apache.geode.internal.logging.LogService;
import org.apache.geode.internal.logging.LoggingExecutors;
import org.apache.geode.internal.net.BufferPool;
@@ -210,7 +211,7 @@ private Executor createThreadPoolForIO(boolean conserveSockets) {
if (conserveSockets) {
return LoggingExecutors.newThreadOnEachExecute("SharedP2PReader");
} else {
- return LoggingExecutors.newThreadPoolWithSynchronousFeed("UnsharedP2PReader", 1,
+ return CoreLoggingExecutors.newThreadPoolWithSynchronousFeed("UnsharedP2PReader", 1,
Integer.MAX_VALUE, READER_POOL_KEEP_ALIVE_TIME);
}
}
diff --git a/geode-core/src/main/java/org/apache/geode/logging/internal/SimpleLoggingProvider.java b/geode-core/src/main/java/org/apache/geode/logging/internal/SimpleLoggingProvider.java
index 02cca4ed2048..03a68b21a541 100644
--- a/geode-core/src/main/java/org/apache/geode/logging/internal/SimpleLoggingProvider.java
+++ b/geode-core/src/main/java/org/apache/geode/logging/internal/SimpleLoggingProvider.java
@@ -14,8 +14,6 @@
*/
package org.apache.geode.logging.internal;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
import org.apache.geode.logging.internal.spi.LogConfig;
import org.apache.geode.logging.internal.spi.LogLevelUpdateOccurs;
@@ -39,11 +37,6 @@ public void cleanup() {
// nothing
}
- @Override
- public Logger getLogger(String name) {
- return LogManager.getLogger(name);
- }
-
@Override
public int getPriority() {
return Integer.MIN_VALUE;
diff --git a/geode-core/src/main/java/org/apache/geode/logging/internal/spi/LoggingProvider.java b/geode-core/src/main/java/org/apache/geode/logging/internal/spi/LoggingProvider.java
index 9b469595564c..169fcbf3f652 100644
--- a/geode-core/src/main/java/org/apache/geode/logging/internal/spi/LoggingProvider.java
+++ b/geode-core/src/main/java/org/apache/geode/logging/internal/spi/LoggingProvider.java
@@ -14,7 +14,6 @@
*/
package org.apache.geode.logging.internal.spi;
-import org.apache.logging.log4j.Logger;
import org.apache.geode.cache.Cache;
import org.apache.geode.distributed.ConfigurationProperties;
@@ -83,16 +82,6 @@ default void enableLoggingToStandardOutput() {
// override to enable logging to stdout
}
- /**
- * Returns a Logger with the specified name.
- *
- * @param name The logger name. If null the name of the calling class will be used.
- * @return The Logger.
- * @throws UnsupportedOperationException if {@code name} is {@code null} and the calling class
- * cannot be determined.
- */
- Logger getLogger(String name);
-
/**
* If multiple {@code LoggingProvider}s are loadable then the instance with the highest priority
* or the first iterable element will be used.
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/MembershipDependenciesJUnitTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/MembershipDependenciesJUnitTest.java
index 3ac1bed3ff33..8fa56fe3a530 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/MembershipDependenciesJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/membership/MembershipDependenciesJUnitTest.java
@@ -31,7 +31,6 @@
import org.apache.geode.CancelCriterion;
import org.apache.geode.GemFireException;
import org.apache.geode.InternalGemFireError;
-import org.apache.geode.SystemFailure;
import org.apache.geode.alerting.internal.spi.AlertingAction;
import org.apache.geode.distributed.DistributedMember;
import org.apache.geode.distributed.Locator;
@@ -100,6 +99,9 @@ public class MembershipDependenciesJUnitTest {
.onlyDependOnClassesThat(
resideInAPackage("org.apache.geode.distributed.internal.membership.gms..")
.or(resideInAPackage("org.apache.geode.internal.serialization.."))
+ .or(type(LogService.class))
+ .or(type(LoggingExecutors.class))
+ .or(type(LoggingThread.class))
.or(not(resideInAPackage("org.apache.geode..")))
.or(resideInAPackage("org.apache.geode.test.."))
@@ -118,15 +120,6 @@ public class MembershipDependenciesJUnitTest {
// TODO: Membership needs its own config object
.or(type(MembershipManager.class))
-
- // TODO: Break dependency on geode logger
- .or(type(LogService.class))
- .or(assignableTo(LoggingThread.class))
- .or(type(LoggingExecutors.class))
-
- // TODO
- .or(type(SystemFailure.class))
-
// TODO
.or(assignableTo(CancelCriterion.class))
diff --git a/geode-core/src/test/java/org/apache/geode/internal/logging/LogServiceTest.java b/geode-core/src/test/java/org/apache/geode/internal/logging/LogServiceTest.java
deleted file mode 100644
index c8fa7a2e69f7..000000000000
--- a/geode-core/src/test/java/org/apache/geode/internal/logging/LogServiceTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.internal.logging;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-import org.apache.logging.log4j.Logger;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestName;
-
-import org.apache.geode.logging.internal.SimpleLoggingProvider;
-import org.apache.geode.logging.internal.spi.LoggingProvider;
-import org.apache.geode.test.junit.categories.LoggingTest;
-
-/**
- * Unit tests for {@link LogService}.
- */
-@Category(LoggingTest.class)
-public class LogServiceTest {
-
- private static final String APPLICATION_LOGGER_NAME = "com.application";
-
- @Rule
- public TestName testName = new TestName();
-
- @Test
- public void getLoggerReturnsLoggerWithCallerClassName() {
- Logger logger = LogService.getLogger();
-
- assertThat(logger.getName()).isEqualTo(getClass().getName());
- }
-
- @Test
- public void getLoggerNameReturnsLoggerWithSpecifiedName() {
- Logger logger = LogService.getLogger(APPLICATION_LOGGER_NAME);
-
- assertThat(logger.getName()).isEqualTo(APPLICATION_LOGGER_NAME);
- }
-
- @Test
- public void getLoggingProviderReturnsSimpleLoggingProviderByDefault() {
- LoggingProvider loggingProvider = LogService.getLoggingProvider();
-
- assertThat(loggingProvider).isInstanceOf(SimpleLoggingProvider.class);
- }
-}
diff --git a/geode-core/src/test/java/org/apache/geode/logging/internal/LoggingProviderLoaderTest.java b/geode-core/src/test/java/org/apache/geode/logging/internal/LoggingProviderLoaderTest.java
index 67304a9456dc..b5f279211e41 100644
--- a/geode-core/src/test/java/org/apache/geode/logging/internal/LoggingProviderLoaderTest.java
+++ b/geode-core/src/test/java/org/apache/geode/logging/internal/LoggingProviderLoaderTest.java
@@ -17,7 +17,6 @@
import static org.apache.geode.logging.internal.LoggingProviderLoader.LOGGING_PROVIDER_NAME_PROPERTY;
import static org.assertj.core.api.Assertions.assertThat;
-import org.apache.logging.log4j.Logger;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -82,6 +81,13 @@ public void createProviderAgent_usesNullProviderAgent_whenClassCastException() {
assertThat(value).isInstanceOf(SimpleLoggingProvider.class);
}
+ @Test
+ public void getLoggingProviderReturnsSimpleLoggingProviderByDefault() {
+ LoggingProvider loggingProvider = new LoggingProviderLoader().load();
+
+ assertThat(loggingProvider).isInstanceOf(SimpleLoggingProvider.class);
+ }
+
static class TestLoggingProvider implements LoggingProvider {
@Override
@@ -96,11 +102,6 @@ public void cleanup() {
// nothing
}
- @Override
- public Logger getLogger(String name) {
- return null;
- }
-
@Override
public int getPriority() {
return Integer.MAX_VALUE;
diff --git a/geode-core/src/test/resources/expected-pom.xml b/geode-core/src/test/resources/expected-pom.xml
index 1e3bb4fb3b0b..50e4a80b0651 100644
--- a/geode-core/src/test/resources/expected-pom.xml
+++ b/geode-core/src/test/resources/expected-pom.xml
@@ -242,6 +242,11 @@
rmiio
runtime
+
+ org.apache.geode
+ geode-logging
+ runtime
+
org.apache.geode
geode-unsafe
diff --git a/geode-cq/build.gradle b/geode-cq/build.gradle
index cc0b8e69ee43..b2cdd6d28858 100644
--- a/geode-cq/build.gradle
+++ b/geode-cq/build.gradle
@@ -23,6 +23,7 @@ apply from: "${project.projectDir}/../gradle/publish-java.gradle"
dependencies {
compile(platform(project(':boms:geode-all-bom')))
compile(project(':geode-core'))
+ implementation(project(':geode-logging'))
implementation(project(':geode-serialization'))
testCompile(project(':geode-junit')) {
exclude module: 'geode-core'
diff --git a/geode-cq/src/test/resources/expected-pom.xml b/geode-cq/src/test/resources/expected-pom.xml
index 073ef6add501..0ca63e1678f9 100644
--- a/geode-cq/src/test/resources/expected-pom.xml
+++ b/geode-cq/src/test/resources/expected-pom.xml
@@ -56,6 +56,11 @@
log4j-api
compile
+
+ org.apache.geode
+ geode-logging
+ runtime
+
org.apache.geode
geode-serialization
diff --git a/geode-docs/tools_modules/http_session_mgmt/tomcat_installing_the_module.html.md.erb b/geode-docs/tools_modules/http_session_mgmt/tomcat_installing_the_module.html.md.erb
index 6c633f2953aa..1412b0931be2 100644
--- a/geode-docs/tools_modules/http_session_mgmt/tomcat_installing_the_module.html.md.erb
+++ b/geode-docs/tools_modules/http_session_mgmt/tomcat_installing_the_module.html.md.erb
@@ -33,7 +33,9 @@ This topic describes how to install the HTTP session management module for Tomca
- fastutil jar
- geode-commons jar
- geode-core jar
+ - geode-logging jar
- geode-management jar
+ - geode-serialization jar
- javax.transaction-api jar
- jgroups jar
- log4j-api jar
diff --git a/geode-docs/tools_modules/http_session_mgmt/weblogic_setting_up_the_module.html.md.erb b/geode-docs/tools_modules/http_session_mgmt/weblogic_setting_up_the_module.html.md.erb
index 499f9f8bb4c0..9381b717b7be 100644
--- a/geode-docs/tools_modules/http_session_mgmt/weblogic_setting_up_the_module.html.md.erb
+++ b/geode-docs/tools_modules/http_session_mgmt/weblogic_setting_up_the_module.html.md.erb
@@ -70,6 +70,7 @@ To modify your war or ear file manually, make the following updates:
- geode-core jar
- geode-json jar
- geode-management jar
+ - geode-logging jar
- geode-serialization jar
- javax.transaction-api jar
- jgroups jar
diff --git a/geode-dunit/build.gradle b/geode-dunit/build.gradle
index ec36c96e910f..5f6e97a657d0 100755
--- a/geode-dunit/build.gradle
+++ b/geode-dunit/build.gradle
@@ -22,6 +22,7 @@ apply from: "${project.projectDir}/../gradle/publish-java.gradle"
dependencies {
compile(platform(project(':boms:geode-all-bom')))
+ implementation(project(':geode-logging'))
implementation(project(':geode-serialization'))
compile(project(':geode-core'))
implementation(project(':geode-log4j')) {
diff --git a/geode-dunit/src/test/resources/expected-pom.xml b/geode-dunit/src/test/resources/expected-pom.xml
index 64ec9c01dbfe..6a7eac9fdbf5 100644
--- a/geode-dunit/src/test/resources/expected-pom.xml
+++ b/geode-dunit/src/test/resources/expected-pom.xml
@@ -170,6 +170,11 @@
+
+ org.apache.geode
+ geode-logging
+ runtime
+
org.apache.geode
geode-serialization
diff --git a/geode-experimental-driver/build.gradle b/geode-experimental-driver/build.gradle
index d5d8802dc43d..6820baba4110 100644
--- a/geode-experimental-driver/build.gradle
+++ b/geode-experimental-driver/build.gradle
@@ -44,6 +44,7 @@ dependencies {
exclude module: 'junit-dep'
}
+ integrationTestImplementation(project(':geode-logging'))
integrationTestImplementation(project(':geode-serialization'))
integrationTestCompile('com.github.stefanbirkner:system-rules') {
exclude module: 'junit-dep'
diff --git a/geode-http-service/build.gradle b/geode-http-service/build.gradle
index ac29a781b653..3aad67fd286c 100755
--- a/geode-http-service/build.gradle
+++ b/geode-http-service/build.gradle
@@ -21,6 +21,7 @@ apply from: "${project.projectDir}/../gradle/publish-java.gradle"
dependencies {
compile(platform(project(':boms:geode-all-bom')))
+ implementation(project(':geode-logging'))
implementation('org.springframework:spring-web')
implementation('org.apache.httpcomponents:httpclient')
@@ -37,3 +38,4 @@ dependencies {
testCompile(project(':geode-common'))
testCompile(project(':geode-junit'))
}
+
diff --git a/geode-http-service/src/test/resources/expected-pom.xml b/geode-http-service/src/test/resources/expected-pom.xml
index 154fdbafe00a..26ada1ca83b4 100644
--- a/geode-http-service/src/test/resources/expected-pom.xml
+++ b/geode-http-service/src/test/resources/expected-pom.xml
@@ -61,6 +61,11 @@
log4j-api
runtime
+
+ org.apache.geode
+ geode-logging
+ runtime
+
org.eclipse.jetty
jetty-webapp
diff --git a/geode-junit/build.gradle b/geode-junit/build.gradle
index 53281dec054c..da6b0c5ceb16 100755
--- a/geode-junit/build.gradle
+++ b/geode-junit/build.gradle
@@ -24,6 +24,7 @@ dependencies {
compile(platform(project(':boms:geode-all-bom')))
compileOnly(project(':geode-core'))
+ compileOnly(project(':geode-logging'))
compileOnly(project(':geode-serialization'))
compileOnly(project(':geode-unsafe'))
diff --git a/geode-log4j/build.gradle b/geode-log4j/build.gradle
index 4f77b33751ad..ce110b2a734c 100644
--- a/geode-log4j/build.gradle
+++ b/geode-log4j/build.gradle
@@ -25,8 +25,9 @@ dependencies {
api(platform(project(':boms:geode-all-bom')))
implementation(project(':geode-core'))
+ implementation(project(':geode-logging'))
- api('org.apache.logging.log4j:log4j-api')
+ implementation('org.apache.logging.log4j:log4j-api')
implementation('org.apache.logging.log4j:log4j-core')
//This routes slf4j logs to log4j. Shiro and micrometer use slf4j
diff --git a/geode-log4j/src/integrationTest/java/org/apache/geode/logging/log4j/internal/impl/FastLoggerIntegrationTest.java b/geode-log4j/src/integrationTest/java/org/apache/geode/logging/log4j/internal/impl/FastLoggerIntegrationTest.java
index 1a882121d989..eda787421e25 100644
--- a/geode-log4j/src/integrationTest/java/org/apache/geode/logging/log4j/internal/impl/FastLoggerIntegrationTest.java
+++ b/geode-log4j/src/integrationTest/java/org/apache/geode/logging/log4j/internal/impl/FastLoggerIntegrationTest.java
@@ -41,12 +41,12 @@
import org.junit.rules.TemporaryFolder;
import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.logging.log4j.FastLogger;
import org.apache.geode.logging.internal.Configuration;
import org.apache.geode.logging.internal.spi.LogConfig;
import org.apache.geode.logging.internal.spi.LogConfigSupplier;
import org.apache.geode.logging.internal.spi.LogLevelUpdateOccurs;
import org.apache.geode.logging.internal.spi.LogLevelUpdateScope;
-import org.apache.geode.logging.log4j.internal.FastLogger;
import org.apache.geode.test.junit.categories.LoggingTest;
/**
diff --git a/geode-log4j/src/integrationTest/java/org/apache/geode/logging/log4j/internal/impl/FastLoggerWithDefaultConfigIntegrationTest.java b/geode-log4j/src/integrationTest/java/org/apache/geode/logging/log4j/internal/impl/FastLoggerWithDefaultConfigIntegrationTest.java
index 448a2993bd76..f2f02f1fc0a9 100755
--- a/geode-log4j/src/integrationTest/java/org/apache/geode/logging/log4j/internal/impl/FastLoggerWithDefaultConfigIntegrationTest.java
+++ b/geode-log4j/src/integrationTest/java/org/apache/geode/logging/log4j/internal/impl/FastLoggerWithDefaultConfigIntegrationTest.java
@@ -25,12 +25,12 @@
import org.junit.experimental.categories.Category;
import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.logging.log4j.FastLogger;
import org.apache.geode.logging.internal.Configuration;
import org.apache.geode.logging.internal.spi.LogConfig;
import org.apache.geode.logging.internal.spi.LogConfigSupplier;
import org.apache.geode.logging.internal.spi.LogLevelUpdateOccurs;
import org.apache.geode.logging.internal.spi.LogLevelUpdateScope;
-import org.apache.geode.logging.log4j.internal.FastLogger;
import org.apache.geode.test.junit.categories.LoggingTest;
/**
diff --git a/geode-log4j/src/integrationTest/java/org/apache/geode/logging/log4j/internal/impl/LoggingWithDistributedSystemIntegrationTest.java b/geode-log4j/src/integrationTest/java/org/apache/geode/logging/log4j/internal/impl/LoggingWithDistributedSystemIntegrationTest.java
index c58f23998f7a..36a08f1642d1 100755
--- a/geode-log4j/src/integrationTest/java/org/apache/geode/logging/log4j/internal/impl/LoggingWithDistributedSystemIntegrationTest.java
+++ b/geode-log4j/src/integrationTest/java/org/apache/geode/logging/log4j/internal/impl/LoggingWithDistributedSystemIntegrationTest.java
@@ -52,10 +52,10 @@
import org.apache.geode.distributed.internal.DistributionConfig;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.logging.log4j.FastLogger;
import org.apache.geode.logging.internal.log4j.LogWriterLogger;
import org.apache.geode.logging.internal.spi.LogConfig;
import org.apache.geode.logging.internal.spi.LogWriterLevel;
-import org.apache.geode.logging.log4j.internal.FastLogger;
import org.apache.geode.test.assertj.LogFileAssert;
import org.apache.geode.test.junit.categories.LoggingTest;
diff --git a/geode-log4j/src/jmh/java/org/apache/geode/logging/log4j/internal/FastLoggerDisabledLevelBenchmark.java b/geode-log4j/src/jmh/java/org/apache/geode/logging/log4j/internal/FastLoggerDisabledLevelBenchmark.java
index 0ec3b6072377..20ba218c99dc 100644
--- a/geode-log4j/src/jmh/java/org/apache/geode/logging/log4j/internal/FastLoggerDisabledLevelBenchmark.java
+++ b/geode-log4j/src/jmh/java/org/apache/geode/logging/log4j/internal/FastLoggerDisabledLevelBenchmark.java
@@ -36,6 +36,8 @@
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;
+import org.apache.geode.internal.logging.log4j.FastLogger;
+
@Measurement(iterations = 1, time = 1, timeUnit = MINUTES)
@Warmup(iterations = 1, time = 1, timeUnit = MINUTES)
@Fork(1)
diff --git a/geode-log4j/src/jmh/java/org/apache/geode/logging/log4j/internal/FastLoggerEnabledLevelBenchmark.java b/geode-log4j/src/jmh/java/org/apache/geode/logging/log4j/internal/FastLoggerEnabledLevelBenchmark.java
index e88d4ac727b2..c5efa1ff9c3e 100644
--- a/geode-log4j/src/jmh/java/org/apache/geode/logging/log4j/internal/FastLoggerEnabledLevelBenchmark.java
+++ b/geode-log4j/src/jmh/java/org/apache/geode/logging/log4j/internal/FastLoggerEnabledLevelBenchmark.java
@@ -36,6 +36,8 @@
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;
+import org.apache.geode.internal.logging.log4j.FastLogger;
+
@Measurement(iterations = 1, time = 1, timeUnit = MINUTES)
@Warmup(iterations = 1, time = 1, timeUnit = MINUTES)
@Fork(1)
diff --git a/geode-log4j/src/jmh/java/org/apache/geode/logging/log4j/internal/FastLoggerParameterTypeBenchmark.java b/geode-log4j/src/jmh/java/org/apache/geode/logging/log4j/internal/FastLoggerParameterTypeBenchmark.java
index a9c331ab3b12..0ebdcfd7eea1 100644
--- a/geode-log4j/src/jmh/java/org/apache/geode/logging/log4j/internal/FastLoggerParameterTypeBenchmark.java
+++ b/geode-log4j/src/jmh/java/org/apache/geode/logging/log4j/internal/FastLoggerParameterTypeBenchmark.java
@@ -39,6 +39,8 @@
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;
+import org.apache.geode.internal.logging.log4j.FastLogger;
+
@Measurement(iterations = 1, time = 1, timeUnit = MINUTES)
@Warmup(iterations = 1, time = 1, timeUnit = MINUTES)
@Fork(1)
diff --git a/geode-log4j/src/main/java/org/apache/geode/logging/log4j/internal/impl/AppenderContext.java b/geode-log4j/src/main/java/org/apache/geode/logging/log4j/internal/impl/AppenderContext.java
deleted file mode 100644
index dabe11533e0c..000000000000
--- a/geode-log4j/src/main/java/org/apache/geode/logging/log4j/internal/impl/AppenderContext.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.logging.log4j.internal.impl;
-
-import org.apache.logging.log4j.core.Logger;
-import org.apache.logging.log4j.core.LoggerContext;
-import org.apache.logging.log4j.core.config.LoggerConfig;
-
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.logging.log4j.internal.FastLogger;
-
-/**
- * Provides the LoggerContext and LoggerConfig for GemFire appenders to attach to. These appenders
- * include AlertAppender and LogWriterAppender.
- *
- */
-public class AppenderContext {
-
- /**
- * "org.apache" is a good alternative for limiting alerts to just gemstone packages, otherwise
- * ROOT is used
- */
- public static final String LOGGER_PROPERTY = "gemfire.logging.appenders.LOGGER";
-
- public AppenderContext() {
- this(System.getProperty(LOGGER_PROPERTY, ""));
- }
-
- private final String name;
-
- public AppenderContext(final String name) {
- this.name = name;
- }
-
- public String getName() {
- return name;
- }
-
- public LoggerContext getLoggerContext() {
- return getLogger().getContext();
- }
-
- public LoggerConfig getLoggerConfig() {
- final Logger logger = getLogger();
- final LoggerContext context = logger.getContext();
- return context.getConfiguration().getLoggerConfig(logger.getName());
- }
-
- public String toString() {
- StringBuilder sb = new StringBuilder();
- sb.append("AppenderContext:");
- if ("".equals(name)) {
- sb.append("");
- } else {
- sb.append(name);
- }
- return sb.toString();
- }
-
- private Logger getLogger() {
- Logger logger = null;
- if ("".equals(name)) {
- logger = (Logger) LogService.getRootLogger();
- } else {
- logger = (Logger) ((FastLogger) LogService.getLogger(name)).getExtendedLogger();
- }
- return logger;
- }
-}
diff --git a/geode-log4j/src/main/java/org/apache/geode/logging/log4j/internal/impl/Log4jLoggingProvider.java b/geode-log4j/src/main/java/org/apache/geode/logging/log4j/internal/impl/Log4jLoggingProvider.java
index 80f46a10bc45..75ccbbe02e94 100644
--- a/geode-log4j/src/main/java/org/apache/geode/logging/log4j/internal/impl/Log4jLoggingProvider.java
+++ b/geode-log4j/src/main/java/org/apache/geode/logging/log4j/internal/impl/Log4jLoggingProvider.java
@@ -33,13 +33,12 @@
import org.apache.logging.log4j.core.lookup.StrSubstitutor;
import org.apache.geode.annotations.VisibleForTesting;
+import org.apache.geode.internal.logging.log4j.FastLogger;
import org.apache.geode.logging.internal.spi.LogConfig;
import org.apache.geode.logging.internal.spi.LogLevelUpdateOccurs;
import org.apache.geode.logging.internal.spi.LogLevelUpdateScope;
import org.apache.geode.logging.internal.spi.LogWriterLevel;
import org.apache.geode.logging.internal.spi.LoggingProvider;
-import org.apache.geode.logging.log4j.internal.FastLogger;
-import org.apache.geode.logging.log4j.internal.impl.message.GemFireParameterizedMessageFactory;
/**
* Log4J 2 implementation of {@link LoggingProvider}.
@@ -184,11 +183,6 @@ public void disableLoggingToStandardOutput() {
}
}
- @Override
- public org.apache.logging.log4j.Logger getLogger(final String name) {
- return new FastLogger(LogManager.getLogger(name, GemFireParameterizedMessageFactory.get()));
- }
-
@Override
public int getPriority() {
return 0;
diff --git a/geode-log4j/src/test/resources/expected-pom.xml b/geode-log4j/src/test/resources/expected-pom.xml
index fe4a2b223322..41217bd66c93 100644
--- a/geode-log4j/src/test/resources/expected-pom.xml
+++ b/geode-log4j/src/test/resources/expected-pom.xml
@@ -47,13 +47,18 @@
- org.apache.logging.log4j
- log4j-api
- compile
+ org.apache.geode
+ geode-core
+ runtime
org.apache.geode
- geode-core
+ geode-logging
+ runtime
+
+
+ org.apache.logging.log4j
+ log4j-api
runtime
diff --git a/geode-logging/build.gradle b/geode-logging/build.gradle
new file mode 100644
index 000000000000..7e424560a1f3
--- /dev/null
+++ b/geode-logging/build.gradle
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle"
+
+apply from: "${project.projectDir}/../gradle/publish-java.gradle"
+
+dependencies {
+ compile(platform(project(':boms:geode-all-bom')))
+
+ // Geode-common has annotations and other pieces used by geode-logging
+ api(project(':geode-common'))
+
+ implementation('org.apache.logging.log4j:log4j-api')
+
+ testCompile(project(':geode-junit')) {
+ exclude module: 'geode-logging'
+ }
+ testCompile(project(':geode-concurrency-test'))
+
+ testCompile('org.mockito:mockito-core')
+ testCompile('junit:junit')
+ testCompile('org.assertj:assertj-core')
+
+ testRuntime(project(':geode-old-versions'))
+
+ integrationTestCompile(project(':geode-junit')) {
+ exclude module: 'geode-logging'
+ }
+ integrationTestCompile(project(':geode-dunit')) {
+ exclude module: 'geode-logging'
+ }
+ integrationTestCompile('pl.pragmatists:JUnitParams')
+ distributedTestCompile(project(':geode-junit')) {
+ exclude module: 'geode-logging'
+ }
+ distributedTestCompile(project(':geode-dunit')) {
+ exclude module: 'geode-logging'
+ }
+ distributedTestCompile('pl.pragmatists:JUnitParams')
+ distributedTestRuntime(project(':geode-old-versions'))
+ upgradeTestRuntime(project(':geode-old-versions'))
+
+}
+
+distributedTest {
+ // Some tests have inner tests that should be ignored
+ exclude "**/*\$*.class"
+}
+
+
diff --git a/geode-core/src/main/java/org/apache/geode/internal/logging/LogService.java b/geode-logging/src/main/java/org/apache/geode/internal/logging/LogService.java
similarity index 71%
rename from geode-core/src/main/java/org/apache/geode/internal/logging/LogService.java
rename to geode-logging/src/main/java/org/apache/geode/internal/logging/LogService.java
index a543634cb9e2..99952d0266b7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/logging/LogService.java
+++ b/geode-logging/src/main/java/org/apache/geode/internal/logging/LogService.java
@@ -18,18 +18,14 @@
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.util.StackLocator;
-import org.apache.geode.annotations.Immutable;
-import org.apache.geode.annotations.VisibleForTesting;
-import org.apache.geode.logging.internal.LoggingProviderLoader;
-import org.apache.geode.logging.internal.spi.LoggingProvider;
+import org.apache.geode.internal.logging.log4j.FastLogger;
+import org.apache.geode.internal.logging.log4j.message.GemFireParameterizedMessageFactory;
/**
* Provides Log4J2 Loggers with customized optimizations for Geode:
*/
-public class LogService extends LogManager {
+public class LogService {
- @Immutable
- private static final LoggingProvider loggingProvider = new LoggingProviderLoader().load();
private LogService() {
// do not instantiate
@@ -42,15 +38,10 @@ private LogService() {
*/
public static Logger getLogger() {
String name = StackLocator.getInstance().getCallerClass(2).getName();
- return loggingProvider.getLogger(name);
+ return getLogger(name);
}
public static Logger getLogger(String name) {
- return loggingProvider.getLogger(name);
- }
-
- @VisibleForTesting
- static LoggingProvider getLoggingProvider() {
- return loggingProvider;
+ return new FastLogger(LogManager.getLogger(name, GemFireParameterizedMessageFactory.INSTANCE));
}
}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/EntriesCollection.java b/geode-logging/src/main/java/org/apache/geode/internal/logging/LogWithToString.java
similarity index 79%
rename from geode-core/src/main/java/org/apache/geode/internal/cache/EntriesCollection.java
rename to geode-logging/src/main/java/org/apache/geode/internal/logging/LogWithToString.java
index 3d55dd832f64..77541bb7d19a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/EntriesCollection.java
+++ b/geode-logging/src/main/java/org/apache/geode/internal/logging/LogWithToString.java
@@ -12,12 +12,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package org.apache.geode.internal.cache;
+package org.apache.geode.internal.logging;
-import org.apache.geode.cache.Region;
-
-/**
- * Collection of data entries in a data structure such as a {@link Region}.
- */
-public interface EntriesCollection {
+public interface LogWithToString {
}
diff --git a/geode-logging/src/main/java/org/apache/geode/internal/logging/LoggingExecutors.java b/geode-logging/src/main/java/org/apache/geode/internal/logging/LoggingExecutors.java
new file mode 100644
index 000000000000..8c9f68a40724
--- /dev/null
+++ b/geode-logging/src/main/java/org/apache/geode/internal/logging/LoggingExecutors.java
@@ -0,0 +1,114 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.logging;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.ForkJoinPool;
+import java.util.concurrent.ForkJoinWorkerThread;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.RejectedExecutionHandler;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
+import java.util.concurrent.SynchronousQueue;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+
+public class LoggingExecutors {
+ public static ScheduledExecutorService newScheduledThreadPool(String threadName, int poolSize,
+ boolean executeDelayedTasks) {
+ ScheduledThreadPoolExecutor result =
+ new ScheduledThreadPoolExecutor(poolSize, new LoggingThreadFactory(threadName));
+ result.setExecuteExistingDelayedTasksAfterShutdownPolicy(executeDelayedTasks);
+ return result;
+ }
+
+ public static ExecutorService newFixedThreadPoolWithFeedSize(String threadName,
+ int poolSize, int feedSize) {
+ LinkedBlockingQueue feed = new LinkedBlockingQueue<>(feedSize);
+ RejectedExecutionHandler rejectionHandler = new ThreadPoolExecutor.CallerRunsPolicy();
+ ThreadFactory threadFactory = new LoggingThreadFactory(threadName);
+ ThreadPoolExecutor executor = new ThreadPoolExecutor(poolSize, poolSize, 10, SECONDS, feed,
+ threadFactory, rejectionHandler);
+ executor.allowCoreThreadTimeOut(true);
+ return executor;
+ }
+
+ public static ExecutorService newSingleThreadExecutor(String threadName, boolean isDaemon) {
+ ThreadFactory threadFactory = new LoggingThreadFactory(threadName, isDaemon);
+ return new ThreadPoolExecutor(1, 1, 0L, SECONDS,
+ new LinkedBlockingQueue(),
+ threadFactory);
+ }
+
+ public static ExecutorService newCachedThreadPool(String threadName, boolean isDaemon) {
+ ThreadFactory threadFactory = new LoggingThreadFactory(threadName, isDaemon);
+ return new ThreadPoolExecutor(0, Integer.MAX_VALUE,
+ 60L, TimeUnit.SECONDS,
+ new SynchronousQueue(),
+ threadFactory);
+ }
+
+ public static ExecutorService newWorkStealingPool(String threadName, int maxParallelThreads) {
+ final ForkJoinPool.ForkJoinWorkerThreadFactory factory = pool -> {
+ ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool);
+ LoggingUncaughtExceptionHandler.setOnThread(worker);
+ worker.setName(threadName + worker.getPoolIndex());
+ return worker;
+ };
+ return new ForkJoinPool(maxParallelThreads, factory, null, true);
+ }
+
+ public static Executor newThreadOnEachExecute(String threadName) {
+ return command -> new LoggingThread(threadName, command).start();
+ }
+
+ public static ScheduledExecutorService newScheduledThreadPool(String threadName, int poolSize) {
+ return newScheduledThreadPool(threadName, poolSize, true);
+ }
+
+ public static ScheduledExecutorService newSingleThreadScheduledExecutor(String threadName) {
+ return newScheduledThreadPool(threadName, 1);
+ }
+
+ static ThreadPoolExecutor newFixedThreadPool(String threadName, boolean isDaemon,
+ int poolSize, long keepAliveSeconds,
+ BlockingQueue feed) {
+ ThreadFactory threadFactory = new LoggingThreadFactory(threadName, isDaemon);
+ return new ThreadPoolExecutor(poolSize, poolSize,
+ keepAliveSeconds, SECONDS,
+ feed, threadFactory);
+ }
+
+ private static ThreadPoolExecutor newFixedThreadPool(String threadName, boolean isDaemon,
+ long keepAliveSeconds, int poolSize) {
+ LinkedBlockingQueue feed = new LinkedBlockingQueue<>();
+ return newFixedThreadPool(threadName, isDaemon, poolSize, keepAliveSeconds, feed);
+ }
+
+ public static ExecutorService newFixedThreadPool(String threadName, boolean isDaemon,
+ int poolSize) {
+ return newFixedThreadPool(threadName, isDaemon, 0L, poolSize);
+ }
+
+ public static ExecutorService newFixedThreadPoolWithTimeout(String threadName, int poolSize,
+ int keepAliveSeconds) {
+ return newFixedThreadPool(threadName, true, keepAliveSeconds, poolSize);
+ }
+}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/logging/LoggingThread.java b/geode-logging/src/main/java/org/apache/geode/internal/logging/LoggingThread.java
similarity index 84%
rename from geode-core/src/main/java/org/apache/geode/internal/logging/LoggingThread.java
rename to geode-logging/src/main/java/org/apache/geode/internal/logging/LoggingThread.java
index 6fe27d1b16f7..34fa225c2e38 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/logging/LoggingThread.java
+++ b/geode-logging/src/main/java/org/apache/geode/internal/logging/LoggingThread.java
@@ -18,6 +18,7 @@
* LoggingThread instances always handle uncaught exceptions by logging them.
*/
public class LoggingThread extends Thread {
+ private boolean treatExceptionAsFatal;
/**
* Creates a daemon thread with the given name
@@ -49,9 +50,18 @@ public LoggingThread(final String name, final Runnable runnable) {
* @param runnable what the thread will run
*/
public LoggingThread(final String name, final boolean isDaemon, final Runnable runnable) {
+ this(name, isDaemon, runnable, true);
+ }
+
+ public LoggingThread(final String name, final boolean isDaemon, final Runnable runnable,
+ final boolean treatExceptionAsFatal) {
super(runnable, name);
+ this.treatExceptionAsFatal = treatExceptionAsFatal;
setDaemon(isDaemon);
- // TODO: fix escaping reference of this
LoggingUncaughtExceptionHandler.setOnThread(this);
}
+
+ public boolean isTreatExceptionAsFatal() {
+ return treatExceptionAsFatal;
+ }
}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/logging/LoggingThreadFactory.java b/geode-logging/src/main/java/org/apache/geode/internal/logging/LoggingThreadFactory.java
similarity index 100%
rename from geode-core/src/main/java/org/apache/geode/internal/logging/LoggingThreadFactory.java
rename to geode-logging/src/main/java/org/apache/geode/internal/logging/LoggingThreadFactory.java
diff --git a/geode-core/src/main/java/org/apache/geode/internal/logging/LoggingUncaughtExceptionHandler.java b/geode-logging/src/main/java/org/apache/geode/internal/logging/LoggingUncaughtExceptionHandler.java
similarity index 86%
rename from geode-core/src/main/java/org/apache/geode/internal/logging/LoggingUncaughtExceptionHandler.java
rename to geode-logging/src/main/java/org/apache/geode/internal/logging/LoggingUncaughtExceptionHandler.java
index f1d714717f64..3e78ae2f5c21 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/logging/LoggingUncaughtExceptionHandler.java
+++ b/geode-logging/src/main/java/org/apache/geode/internal/logging/LoggingUncaughtExceptionHandler.java
@@ -14,15 +14,12 @@
*/
package org.apache.geode.internal.logging;
-import static org.apache.geode.distributed.internal.InternalDistributedSystem.SHUTDOWN_HOOK_NAME;
-
import java.lang.Thread.UncaughtExceptionHandler;
import java.text.MessageFormat;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.logging.log4j.Logger;
-import org.apache.geode.SystemFailure;
import org.apache.geode.annotations.Immutable;
/**
@@ -33,7 +30,7 @@ public class LoggingUncaughtExceptionHandler {
@Immutable
private static final Implementation handler =
- new Implementation(LogService.getLogger(), error -> SystemFailure.setFailure(error));
+ new Implementation(LogService.getLogger());
public static UncaughtExceptionHandler getInstance() {
return handler;
@@ -46,6 +43,10 @@ public static void setOnThread(final Thread thread) {
handler.setOnThread(thread);
}
+ public static void setFailureSetter(final FailureSetter failureSetter) {
+ handler.setFailureSetter(failureSetter);
+ }
+
public static int getUncaughtExceptionsCount() {
return handler.getUncaughtExceptionsCount();
}
@@ -59,8 +60,7 @@ public static void clearUncaughtExceptionsCount() {
}
// non-private for unit testing
- interface FailureSetter {
-
+ public interface FailureSetter {
void setFailure(VirtualMachineError error);
}
@@ -68,22 +68,21 @@ interface FailureSetter {
static class Implementation implements UncaughtExceptionHandler {
private final Logger logger;
- private final FailureSetter failureSetter;
+ private FailureSetter failureSetter;
private final AtomicInteger uncaughtExceptionsCount = new AtomicInteger();
- Implementation(final Logger logger, final FailureSetter failureSetter) {
+ Implementation(final Logger logger) {
this.logger = logger;
- this.failureSetter = failureSetter;
}
@Override
public void uncaughtException(final Thread t, final Throwable e) {
- if (e instanceof VirtualMachineError) {
+ if (e instanceof VirtualMachineError && failureSetter != null) {
failureSetter.setFailure((VirtualMachineError) e);
}
// Solution to treat the shutdown hook error as a special case.
// Do not change the hook's thread name without also changing it here.
- if (e instanceof NoClassDefFoundError && t.getName().equals(SHUTDOWN_HOOK_NAME)) {
+ if (e instanceof NoClassDefFoundError && !((LoggingThread) t).isTreatExceptionAsFatal()) {
logger.info(
"Uncaught exception in thread {} this message can be disregarded if it occurred during an Application Server shutdown. The Exception message was: {}",
t, e);
@@ -94,6 +93,10 @@ public void uncaughtException(final Thread t, final Throwable e) {
uncaughtExceptionsCount.incrementAndGet();
}
+ void setFailureSetter(final FailureSetter failureSetter) {
+ this.failureSetter = failureSetter;
+ }
+
void setOnThread(final Thread thread) {
thread.setUncaughtExceptionHandler(this);
}
diff --git a/geode-log4j/src/main/java/org/apache/geode/logging/log4j/internal/FastLogger.java b/geode-logging/src/main/java/org/apache/geode/internal/logging/log4j/FastLogger.java
similarity index 97%
rename from geode-log4j/src/main/java/org/apache/geode/logging/log4j/internal/FastLogger.java
rename to geode-logging/src/main/java/org/apache/geode/internal/logging/log4j/FastLogger.java
index 08fe9d517c22..12db1afbbb4a 100644
--- a/geode-log4j/src/main/java/org/apache/geode/logging/log4j/internal/FastLogger.java
+++ b/geode-logging/src/main/java/org/apache/geode/internal/logging/log4j/FastLogger.java
@@ -12,7 +12,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package org.apache.geode.logging.log4j.internal;
+package org.apache.geode.internal.logging.log4j;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.Marker;
@@ -27,6 +27,7 @@
* Overrides is-enabled checks for log levels below INFO to avoid performance penalties when the log
* level is INFO or above. If delegating is true then it will always delegate to
* ExtendedLoggerWrapper for is-enabled checks.
+ *
*/
public class FastLogger extends ExtendedLoggerWrapper {
private static final long serialVersionUID = 7084130827962463327L;
@@ -73,6 +74,6 @@ public boolean isDelegating() {
}
public ExtendedLogger getExtendedLogger() {
- return logger;
+ return super.logger;
}
}
diff --git a/geode-log4j/src/main/java/org/apache/geode/logging/log4j/internal/impl/message/GemFireParameterizedMessage.java b/geode-logging/src/main/java/org/apache/geode/internal/logging/log4j/message/GemFireParameterizedMessage.java
similarity index 97%
rename from geode-log4j/src/main/java/org/apache/geode/logging/log4j/internal/impl/message/GemFireParameterizedMessage.java
rename to geode-logging/src/main/java/org/apache/geode/internal/logging/log4j/message/GemFireParameterizedMessage.java
index be60ab19f5fe..e26ce358b747 100755
--- a/geode-log4j/src/main/java/org/apache/geode/logging/log4j/internal/impl/message/GemFireParameterizedMessage.java
+++ b/geode-logging/src/main/java/org/apache/geode/internal/logging/log4j/message/GemFireParameterizedMessage.java
@@ -1,7 +1,7 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * copyright ownership. The ASF licenses this file to You under the Apache license, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License. You may obtain a
* copy of the License at
*
@@ -9,10 +9,10 @@
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
+ * or implied. See the license for the specific language governing permissions and limitations under
+ * the license.
*/
-package org.apache.geode.logging.log4j.internal.impl.message;
+package org.apache.geode.internal.logging.log4j.message;
import java.text.SimpleDateFormat;
import java.util.Arrays;
@@ -24,8 +24,7 @@
import org.apache.logging.log4j.message.Message;
-import org.apache.geode.cache.Region;
-import org.apache.geode.internal.cache.EntriesCollection;
+import org.apache.geode.internal.logging.LogWithToString;
/**
* Handles messages that consist of a format string containing '{}' to represent each replaceable
@@ -468,7 +467,7 @@ private static void recursiveDeepToString(final Object o, final StringBuilder st
}
// str.append(Arrays.deepToString((Object[]) o));
}
- } else if (o instanceof Map && !(o instanceof Region)) {
+ } else if (o instanceof Map && !(o instanceof LogWithToString)) {
// GEODE: do NOT use Map handling if instanceof Geode Region
// special handling of container Map
final String id = identityToString(o);
@@ -494,8 +493,8 @@ private static void recursiveDeepToString(final Object o, final StringBuilder st
}
str.append('}');
}
- } else if (o instanceof Collection && !(o instanceof EntriesCollection)) {
- // GEODE: do NOT use Collection handling if instanceof Geode EntriesCollection
+ } else if (o instanceof Collection && !(o instanceof LogWithToString)) {
+ // GEODE: do NOT use Collection handling if instanceof Geode EntriesSet
// special handling of container Collection
final String id = identityToString(o);
if (dejaVu.contains(id)) {
diff --git a/geode-log4j/src/main/java/org/apache/geode/logging/log4j/internal/impl/message/GemFireParameterizedMessageFactory.java b/geode-logging/src/main/java/org/apache/geode/internal/logging/log4j/message/GemFireParameterizedMessageFactory.java
similarity index 86%
rename from geode-log4j/src/main/java/org/apache/geode/logging/log4j/internal/impl/message/GemFireParameterizedMessageFactory.java
rename to geode-logging/src/main/java/org/apache/geode/internal/logging/log4j/message/GemFireParameterizedMessageFactory.java
index c041049a11e5..96b1b1f1f5f7 100755
--- a/geode-log4j/src/main/java/org/apache/geode/logging/log4j/internal/impl/message/GemFireParameterizedMessageFactory.java
+++ b/geode-logging/src/main/java/org/apache/geode/internal/logging/log4j/message/GemFireParameterizedMessageFactory.java
@@ -1,7 +1,7 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license
* agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * copyright ownership. The ASF licenses this file to You under the Apache license, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License. You may obtain a
* copy of the License at
*
@@ -9,10 +9,10 @@
*
* Unless required by applicable law or agreed to in writing, software distributed under the License
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
+ * or implied. See the license for the specific language governing permissions and limitations under
+ * the license.
*/
-package org.apache.geode.logging.log4j.internal.impl.message;
+package org.apache.geode.internal.logging.log4j.message;
import org.apache.logging.log4j.message.AbstractMessageFactory;
import org.apache.logging.log4j.message.Message;
@@ -42,13 +42,9 @@ public class GemFireParameterizedMessageFactory extends AbstractMessageFactory {
* Instance of StringFormatterMessageFactory.
*/
@Immutable
- private static final GemFireParameterizedMessageFactory INSTANCE =
+ public static final GemFireParameterizedMessageFactory INSTANCE =
new GemFireParameterizedMessageFactory();
- public static GemFireParameterizedMessageFactory get() {
- return INSTANCE;
- }
-
/**
* Creates {@link ParameterizedMessage} instances.
*
diff --git a/geode-log4j/src/test/java/org/apache/geode/internal/logging/LogServiceTest.java b/geode-logging/src/test/java/org/apache/geode/internal/logging/LogServiceTest.java
similarity index 94%
rename from geode-log4j/src/test/java/org/apache/geode/internal/logging/LogServiceTest.java
rename to geode-logging/src/test/java/org/apache/geode/internal/logging/LogServiceTest.java
index 1715c701e1f0..af6bcee39b62 100644
--- a/geode-log4j/src/test/java/org/apache/geode/internal/logging/LogServiceTest.java
+++ b/geode-logging/src/test/java/org/apache/geode/internal/logging/LogServiceTest.java
@@ -23,8 +23,8 @@
import org.junit.experimental.categories.Category;
import org.junit.rules.TestName;
-import org.apache.geode.logging.log4j.internal.FastLogger;
-import org.apache.geode.logging.log4j.internal.impl.message.GemFireParameterizedMessageFactory;
+import org.apache.geode.internal.logging.log4j.FastLogger;
+import org.apache.geode.internal.logging.log4j.message.GemFireParameterizedMessageFactory;
import org.apache.geode.test.junit.categories.LoggingTest;
/**
diff --git a/geode-core/src/test/java/org/apache/geode/internal/logging/LoggingThreadFactoryTest.java b/geode-logging/src/test/java/org/apache/geode/internal/logging/LoggingThreadFactoryTest.java
similarity index 100%
rename from geode-core/src/test/java/org/apache/geode/internal/logging/LoggingThreadFactoryTest.java
rename to geode-logging/src/test/java/org/apache/geode/internal/logging/LoggingThreadFactoryTest.java
diff --git a/geode-core/src/test/java/org/apache/geode/internal/logging/LoggingThreadTest.java b/geode-logging/src/test/java/org/apache/geode/internal/logging/LoggingThreadTest.java
similarity index 100%
rename from geode-core/src/test/java/org/apache/geode/internal/logging/LoggingThreadTest.java
rename to geode-logging/src/test/java/org/apache/geode/internal/logging/LoggingThreadTest.java
diff --git a/geode-core/src/test/java/org/apache/geode/internal/logging/LoggingUncaughtExceptionHandlerTest.java b/geode-logging/src/test/java/org/apache/geode/internal/logging/LoggingUncaughtExceptionHandlerTest.java
similarity index 83%
rename from geode-core/src/test/java/org/apache/geode/internal/logging/LoggingUncaughtExceptionHandlerTest.java
rename to geode-logging/src/test/java/org/apache/geode/internal/logging/LoggingUncaughtExceptionHandlerTest.java
index be08d6227851..6680c06dd4aa 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/logging/LoggingUncaughtExceptionHandlerTest.java
+++ b/geode-logging/src/test/java/org/apache/geode/internal/logging/LoggingUncaughtExceptionHandlerTest.java
@@ -26,7 +26,6 @@
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.internal.logging.LoggingUncaughtExceptionHandler.FailureSetter;
import org.apache.geode.internal.logging.LoggingUncaughtExceptionHandler.Implementation;
import org.apache.geode.test.junit.categories.LoggingTest;
@@ -45,7 +44,7 @@ public void verifyGetInstanceIsNotNull() {
@Test
public void verifyThatSetOnThreadSetsTheThreadsHandler() {
Thread thread = new Thread();
- Implementation handler = new Implementation(null, null);
+ Implementation handler = new Implementation(null);
handler.setOnThread(thread);
@@ -55,7 +54,7 @@ public void verifyThatSetOnThreadSetsTheThreadsHandler() {
@Test
public void verifyThatCallingUncaughtExceptionIncreasesTheCountByOne() {
Logger logger = mock(Logger.class);
- Implementation handler = new Implementation(logger, null);
+ Implementation handler = new Implementation(logger);
int count = handler.getUncaughtExceptionsCount();
handler.uncaughtException(null, null);
@@ -66,7 +65,7 @@ public void verifyThatCallingUncaughtExceptionIncreasesTheCountByOne() {
@Test
public void verifyThatCallingClearSetsTheCountToZero() {
Logger logger = mock(Logger.class);
- Implementation handler = new Implementation(logger, null);
+ Implementation handler = new Implementation(logger);
// force the count to be non-zero
handler.uncaughtException(null, null);
@@ -80,7 +79,7 @@ public void verifyFatalMessageLoggedWhenUncaughtExceptionIsCalled() {
Logger logger = mock(Logger.class);
Thread thread = mock(Thread.class);
Throwable throwable = mock(Throwable.class);
- Implementation handler = new Implementation(logger, null);
+ Implementation handler = new Implementation(logger);
handler.uncaughtException(thread, throwable);
@@ -88,12 +87,12 @@ public void verifyFatalMessageLoggedWhenUncaughtExceptionIsCalled() {
}
@Test
- public void verifyInfoMessageLoggedWhenUncaughtExceptionIsCalledByShutdownHookAndWithNoClassDefFoundError() {
+ public void verifyInfoMessageLoggedWhenUncaughtExceptionIsCalledWithTreatExceptionAsFatalFalse() {
Logger logger = mock(Logger.class);
- Thread thread = new Thread();
- thread.setName(InternalDistributedSystem.SHUTDOWN_HOOK_NAME);
+ Thread thread = new LoggingThread("test", false, () -> {
+ }, false);
Throwable throwable = mock(NoClassDefFoundError.class);
- Implementation handler = new Implementation(logger, null);
+ Implementation handler = new Implementation(logger);
handler.uncaughtException(thread, throwable);
@@ -107,12 +106,12 @@ public void verifySetFailureCalledWhenUncaughtExceptionCalledWithVirtualMachineE
Logger logger = mock(Logger.class);
Thread thread = mock(Thread.class);
VirtualMachineError error = mock(VirtualMachineError.class);
- FailureSetter failureSettor = mock(FailureSetter.class);
- Implementation handler = new Implementation(logger, failureSettor);
-
+ FailureSetter failureSetter = mock(FailureSetter.class);
+ Implementation handler = new Implementation(logger);
+ handler.setFailureSetter(failureSetter);
handler.uncaughtException(thread, error);
- verify(failureSettor).setFailure(error);
+ verify(failureSetter).setFailure(error);
}
}
diff --git a/geode-log4j/src/test/java/org/apache/geode/logging/log4j/internal/FastLoggerTest.java b/geode-logging/src/test/java/org/apache/geode/logging/log4j/internal/FastLoggerTest.java
similarity index 99%
rename from geode-log4j/src/test/java/org/apache/geode/logging/log4j/internal/FastLoggerTest.java
rename to geode-logging/src/test/java/org/apache/geode/logging/log4j/internal/FastLoggerTest.java
index d1fe09e22386..08ad881e7852 100755
--- a/geode-log4j/src/test/java/org/apache/geode/logging/log4j/internal/FastLoggerTest.java
+++ b/geode-logging/src/test/java/org/apache/geode/logging/log4j/internal/FastLoggerTest.java
@@ -37,6 +37,7 @@
import org.mockito.junit.MockitoRule;
import org.mockito.quality.Strictness;
+import org.apache.geode.internal.logging.log4j.FastLogger;
import org.apache.geode.test.junit.categories.LoggingTest;
/**
diff --git a/geode-logging/src/test/resources/expected-pom.xml b/geode-logging/src/test/resources/expected-pom.xml
new file mode 100644
index 000000000000..0e8d9fb12916
--- /dev/null
+++ b/geode-logging/src/test/resources/expected-pom.xml
@@ -0,0 +1,60 @@
+
+
+
+ 4.0.0
+ org.apache.geode
+ geode-logging
+ 1.11.0-SNAPSHOT
+ Apache Geode
+ Apache Geode provides a database-like consistency model, reliable transaction processing and a shared-nothing architecture to maintain very low latency performance with high concurrency processing
+ http://geode.apache.org
+
+
+ The Apache Software License, Version 2.0
+ http://www.apache.org/licenses/LICENSE-2.0.txt
+
+
+
+ scm:git:https://github.com:apache/geode.git
+ scm:git:https://github.com:apache/geode.git
+ https://github.com/apache/geode
+
+
+
+
+ org.apache.geode
+ geode-all-bom
+ 1.11.0-SNAPSHOT
+ pom
+ import
+
+
+
+
+
+ org.apache.geode
+ geode-common
+ compile
+
+
+ org.apache.logging.log4j
+ log4j-api
+ runtime
+
+
+
diff --git a/geode-lucene/build.gradle b/geode-lucene/build.gradle
index eb65e4858120..91c4e302ab6f 100644
--- a/geode-lucene/build.gradle
+++ b/geode-lucene/build.gradle
@@ -51,6 +51,7 @@ dependencies {
testCompile(project(':geode-junit')) {
exclude module: 'geode-core'
}
+ implementation(project(':geode-logging'))
implementation(project(':geode-serialization'))
compile(project(':geode-core'))
compile('org.apache.lucene:lucene-analyzers-common')
diff --git a/geode-lucene/geode-lucene-test/build.gradle b/geode-lucene/geode-lucene-test/build.gradle
index f382117a0a2a..e2f15da25543 100644
--- a/geode-lucene/geode-lucene-test/build.gradle
+++ b/geode-lucene/geode-lucene-test/build.gradle
@@ -23,6 +23,7 @@ apply from: "${rootDir}/${scriptDir}/standard-subproject-configuration.gradle"
dependencies {
compile(platform(project(':boms:geode-all-bom')))
compile('org.apache.lucene:lucene-core')
+ implementation(project(':geode-logging'))
implementation(project(':geode-serialization'))
compile(project(':geode-core'))
compileOnly(project(':geode-lucene'))
diff --git a/geode-lucene/src/test/resources/expected-pom.xml b/geode-lucene/src/test/resources/expected-pom.xml
index 320bf2259a40..1bdd9e73d8c6 100644
--- a/geode-lucene/src/test/resources/expected-pom.xml
+++ b/geode-lucene/src/test/resources/expected-pom.xml
@@ -119,6 +119,11 @@
+
+ org.apache.geode
+ geode-logging
+ runtime
+
org.apache.geode
geode-serialization
diff --git a/geode-memcached/build.gradle b/geode-memcached/build.gradle
index 6cc76b0d60db..ec382b91965a 100644
--- a/geode-memcached/build.gradle
+++ b/geode-memcached/build.gradle
@@ -22,6 +22,7 @@ apply from: "${project.projectDir}/../gradle/publish-java.gradle"
dependencies {
implementation(platform(project(':boms:geode-all-bom')))
implementation(project(':geode-core'))
+ implementation(project(':geode-logging'))
implementation('org.apache.logging.log4j:log4j-api')
implementation('com.github.stephenc.findbugs:findbugs-annotations')
diff --git a/geode-memcached/src/test/resources/expected-pom.xml b/geode-memcached/src/test/resources/expected-pom.xml
index c07ff1988e27..16bafe46d982 100644
--- a/geode-memcached/src/test/resources/expected-pom.xml
+++ b/geode-memcached/src/test/resources/expected-pom.xml
@@ -51,6 +51,11 @@
geode-core
runtime
+
+ org.apache.geode
+ geode-logging
+ runtime
+
org.apache.logging.log4j
log4j-api
diff --git a/geode-old-client-support/build.gradle b/geode-old-client-support/build.gradle
index 12fad079c6ed..1ceb25a2cc9c 100644
--- a/geode-old-client-support/build.gradle
+++ b/geode-old-client-support/build.gradle
@@ -23,6 +23,7 @@ apply from: "${project.projectDir}/../gradle/publish-java.gradle"
dependencies {
implementation(platform(project(':boms:geode-all-bom')))
implementation(project(':geode-core'))
+ implementation(project(':geode-logging'))
implementation(project(':geode-serialization'))
distributedTestImplementation(project(':geode-dunit')){
exclude module: 'geode-core'
diff --git a/geode-old-client-support/src/test/resources/expected-pom.xml b/geode-old-client-support/src/test/resources/expected-pom.xml
index 1d88eb411b02..b051b6c8821f 100644
--- a/geode-old-client-support/src/test/resources/expected-pom.xml
+++ b/geode-old-client-support/src/test/resources/expected-pom.xml
@@ -51,6 +51,11 @@
geode-core
runtime
+
+ org.apache.geode
+ geode-logging
+ runtime
+
org.apache.geode
geode-serialization
diff --git a/geode-protobuf/build.gradle b/geode-protobuf/build.gradle
index 9c0925a73cf4..ea9d0c250fde 100644
--- a/geode-protobuf/build.gradle
+++ b/geode-protobuf/build.gradle
@@ -22,6 +22,7 @@ apply from: "${project.projectDir}/../gradle/publish-java.gradle"
dependencies {
compile(platform(project(':boms:geode-all-bom')))
+ implementation(project(':geode-logging'))
implementation(project(':geode-serialization'))
compile(project(':geode-core'))
compile(project(':geode-protobuf-messages'))
diff --git a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/ProtobufOpsProcessor.java b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/ProtobufOpsProcessor.java
index 189e89e219fb..b172530784d1 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/ProtobufOpsProcessor.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/ProtobufOpsProcessor.java
@@ -34,7 +34,7 @@
@Experimental
public class ProtobufOpsProcessor {
private final ProtobufOperationContextRegistry protobufOperationContextRegistry;
- private static final Logger logger = LogService.getLogger(ProtobufOpsProcessor.class);
+ private static final Logger logger = LogService.getLogger();
public ProtobufOpsProcessor(ProtobufOperationContextRegistry protobufOperationContextRegistry) {
this.protobufOperationContextRegistry = protobufOperationContextRegistry;
diff --git a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/state/RequireVersion.java b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/state/RequireVersion.java
index 7c06b8e89269..2a83b0d3afa6 100644
--- a/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/state/RequireVersion.java
+++ b/geode-protobuf/src/main/java/org/apache/geode/internal/protocol/protobuf/v1/state/RequireVersion.java
@@ -27,13 +27,12 @@
import org.apache.geode.internal.protocol.protobuf.v1.BasicTypes;
import org.apache.geode.internal.protocol.protobuf.v1.MessageExecutionContext;
import org.apache.geode.internal.protocol.protobuf.v1.ProtobufOperationContext;
-import org.apache.geode.internal.protocol.protobuf.v1.ProtobufOpsProcessor;
import org.apache.geode.internal.protocol.protobuf.v1.operations.ProtocolVersionHandler;
import org.apache.geode.internal.protocol.protobuf.v1.state.exception.ConnectionStateException;
import org.apache.geode.internal.security.SecurityService;
public class RequireVersion implements ConnectionState {
- private static final Logger logger = LogService.getLogger(ProtobufOpsProcessor.class);
+ private static final Logger logger = LogService.getLogger();
private final SecurityService securityService;
public RequireVersion(SecurityService securityService) {
diff --git a/geode-protobuf/src/test/resources/expected-pom.xml b/geode-protobuf/src/test/resources/expected-pom.xml
index d222eba94cc6..7e616260c9f8 100644
--- a/geode-protobuf/src/test/resources/expected-pom.xml
+++ b/geode-protobuf/src/test/resources/expected-pom.xml
@@ -71,6 +71,11 @@
shiro-core
compile
+
+ org.apache.geode
+ geode-logging
+ runtime
+
org.apache.geode
geode-serialization
diff --git a/geode-rebalancer/build.gradle b/geode-rebalancer/build.gradle
index 547a37a7540f..ace2859b34d8 100644
--- a/geode-rebalancer/build.gradle
+++ b/geode-rebalancer/build.gradle
@@ -24,6 +24,7 @@ dependencies {
compile(platform(project(':boms:geode-all-bom')))
compile(project(':geode-core'))
implementation(project(':geode-serialization'))
+ implementation(project(':geode-logging'))
integrationTestCompile(project(':geode-junit')) {
exclude module: 'geode-core'
}
diff --git a/geode-rebalancer/src/test/resources/expected-pom.xml b/geode-rebalancer/src/test/resources/expected-pom.xml
index 0a6c90bdbbf0..c3dc713a559f 100644
--- a/geode-rebalancer/src/test/resources/expected-pom.xml
+++ b/geode-rebalancer/src/test/resources/expected-pom.xml
@@ -80,5 +80,10 @@
geode-serialization
runtime
+
+ org.apache.geode
+ geode-logging
+ runtime
+
diff --git a/geode-redis/build.gradle b/geode-redis/build.gradle
index 24f723b21fd7..dc1ec1ce83d7 100644
--- a/geode-redis/build.gradle
+++ b/geode-redis/build.gradle
@@ -22,6 +22,7 @@ apply from: "${project.projectDir}/../gradle/publish-java.gradle"
dependencies {
compile(platform(project(':boms:geode-all-bom')))
implementation(project(':geode-serialization'))
+ implementation(project(':geode-logging'))
compile(project(':geode-core'))
compile('com.github.davidmoten:geo')
compile('io.netty:netty-all')
diff --git a/geode-redis/src/test/resources/expected-pom.xml b/geode-redis/src/test/resources/expected-pom.xml
index d971930c61aa..c30baa995add 100644
--- a/geode-redis/src/test/resources/expected-pom.xml
+++ b/geode-redis/src/test/resources/expected-pom.xml
@@ -71,5 +71,10 @@
geode-serialization
runtime
+
+ org.apache.geode
+ geode-logging
+ runtime
+
diff --git a/geode-wan/build.gradle b/geode-wan/build.gradle
index 81f77f7ae02a..986a5030098f 100644
--- a/geode-wan/build.gradle
+++ b/geode-wan/build.gradle
@@ -26,6 +26,7 @@ dependencies {
// See GEODE-6128 -- ignore xml-apis in linter to avoid changes with every run.
upgradeTestCompile('xml-apis:xml-apis:1.4.01')
}
+ implementation(project(':geode-logging'))
implementation(project(':geode-serialization'))
compile(project(':geode-core'))
diff --git a/geode-wan/src/test/resources/expected-pom.xml b/geode-wan/src/test/resources/expected-pom.xml
index 2df3674c48a8..5291908b720a 100644
--- a/geode-wan/src/test/resources/expected-pom.xml
+++ b/geode-wan/src/test/resources/expected-pom.xml
@@ -51,6 +51,11 @@
geode-core
compile
+
+ org.apache.geode
+ geode-logging
+ runtime
+
org.apache.geode
geode-serialization
diff --git a/geode-web-api/build.gradle b/geode-web-api/build.gradle
index b0a7b547a4ca..b141a5e05797 100644
--- a/geode-web-api/build.gradle
+++ b/geode-web-api/build.gradle
@@ -28,6 +28,7 @@ dependencies {
compileOnly(platform(project(':boms:geode-all-bom')))
compileOnly(project(':geode-core'))
+ compileOnly(project(':geode-logging'))
compileOnly(project(':geode-serialization'))
compileOnly('javax.servlet:javax.servlet-api')
diff --git a/geode-web-management/build.gradle b/geode-web-management/build.gradle
index cb4bf8195627..70132476795c 100644
--- a/geode-web-management/build.gradle
+++ b/geode-web-management/build.gradle
@@ -47,6 +47,7 @@ dependencies {
compile(platform(project(':boms:geode-all-bom'))) {
exclude module: "jackson-annotations"
}
+ compileOnly(project(':geode-logging'))
compileOnly(project(':geode-serialization'))
compileOnly(project(':geode-core'))
diff --git a/geode-web/build.gradle b/geode-web/build.gradle
index 306f73b58787..a02d491a1881 100644
--- a/geode-web/build.gradle
+++ b/geode-web/build.gradle
@@ -30,6 +30,7 @@ dependencies {
//transitive dependencies from geode-web.war. Since geode-web.war is ony run within
//a container that has geode-core on the classpath, is prevents duplicating jars. geode-core
//in particular should not be duplicated in the war.
+ providedCompile(project(':geode-logging'))
providedCompile(project(path: ':geode-core')) {
//spring-web is excluded from the providedCompile configuration to ensure
//that it is included as part of the war. spring-web must be loaded with the war's
@@ -41,7 +42,7 @@ dependencies {
providedCompile(platform(project(':boms:geode-all-bom')))
providedCompile('javax.servlet:javax.servlet-api')
providedCompile('org.apache.logging.log4j:log4j-api')
-
+
implementation('org.springframework:spring-webmvc')
runtimeOnly('org.springframework:spring-aspects') {
diff --git a/settings.gradle b/settings.gradle
index 1669d7e64956..0a1ba3da35f4 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -26,6 +26,7 @@ include 'geode-common'
include 'geode-unsafe'
include 'geode-junit'
include 'geode-dunit'
+include 'geode-logging'
include 'geode-serialization'
include 'geode-core'
include 'geode-log4j'