[ASTERIXDB-1564][CONF] Consistently Use Log4j2
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Replace java.util.logging by Log4j2.
- Excluded classes due to their tests:
- IoUtil
- Tracer
Change-Id: Ic137571292f45de1f1994c61d328b97185012197
Reviewed-on: https://asterix-gerrit.ics.uci.edu/2226
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/pom.xml b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/pom.xml
index 84a2e95..7ef4a98 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/pom.xml
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/pom.xml
@@ -86,5 +86,9 @@
<artifactId>hyracks-util</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ </dependency>
</dependencies>
</project>
\ No newline at end of file
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMDiskComponent.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMDiskComponent.java
index bb27236..26c7b0d 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMDiskComponent.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMDiskComponent.java
@@ -18,9 +18,6 @@
*/
package org.apache.hyracks.storage.am.lsm.common.impls;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.storage.am.common.api.IMetadataPageManager;
import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilter;
@@ -30,10 +27,13 @@
import org.apache.hyracks.storage.am.lsm.common.util.ComponentUtils;
import org.apache.hyracks.storage.am.lsm.common.util.LSMComponentIdUtils;
import org.apache.hyracks.storage.common.MultiComparator;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public abstract class AbstractLSMDiskComponent extends AbstractLSMComponent implements ILSMDiskComponent {
- private static final Logger LOGGER = Logger.getLogger(AbstractLSMDiskComponent.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
private final DiskComponentMetadata metadata;
@@ -129,7 +129,7 @@
// However, we cannot throw an exception here to be compatible with legacy datasets.
// In this case, the disk component would always get a garbage Id [-1, -1], which makes the
// component Id-based optimization useless but still correct.
- LOGGER.warning("Component Id not found from disk component metadata");
+ LOGGER.warn("Component Id not found from disk component metadata");
}
return componentId;
}
@@ -144,7 +144,7 @@
@Override
public void markAsValid(boolean persist) throws HyracksDataException {
ComponentUtils.markAsValid(getMetadataHolder(), persist);
- if (LOGGER.isLoggable(Level.INFO)) {
+ if (LOGGER.isInfoEnabled()) {
LOGGER.log(Level.INFO, "Marked as valid component with id: " + getId());
}
}
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java
index dc808ad..6115ba6 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMIndex.java
@@ -27,8 +27,6 @@
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.hyracks.api.dataflow.value.IBinaryComparatorFactory;
import org.apache.hyracks.api.exceptions.ErrorCode;
@@ -71,9 +69,12 @@
import org.apache.hyracks.storage.common.ISearchOperationCallback;
import org.apache.hyracks.storage.common.buffercache.IBufferCache;
import org.apache.hyracks.util.trace.ITracer;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public abstract class AbstractLSMIndex implements ILSMIndex {
- private static final Logger LOGGER = Logger.getLogger(AbstractLSMIndex.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
protected final ILSMHarness lsmHarness;
protected final IIOManager ioManager;
protected final ILSMIOOperationScheduler ioScheduler;
@@ -694,7 +695,7 @@
if (opCtx.getOperation() == IndexOperation.DELETE_MEMORY_COMPONENT) {
return EmptyComponent.INSTANCE;
} else {
- if (LOGGER.isLoggable(Level.INFO)) {
+ if (LOGGER.isInfoEnabled()) {
FlushOperation flushOp = (FlushOperation) operation;
LOGGER.log(Level.INFO, "Flushing component with id: " + flushOp.getFlushingComponent().getId());
}
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMMemoryComponent.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMMemoryComponent.java
index 15cf8e5..c0bef7d 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMMemoryComponent.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/AbstractLSMMemoryComponent.java
@@ -19,8 +19,6 @@
package org.apache.hyracks.storage.am.lsm.common.impls;
import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.storage.am.lsm.common.api.ILSMComponentFilter;
@@ -31,10 +29,13 @@
import org.apache.hyracks.storage.am.lsm.common.api.LSMOperationType;
import org.apache.hyracks.storage.am.lsm.common.util.LSMComponentIdUtils;
import org.apache.hyracks.storage.common.buffercache.IBufferCache;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public abstract class AbstractLSMMemoryComponent extends AbstractLSMComponent implements ILSMMemoryComponent {
- private static final Logger LOGGER = Logger.getLogger(AbstractLSMMemoryComponent.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
private final IVirtualBufferCache vbc;
private final AtomicBoolean isModified;
private int writerCount;
@@ -280,7 +281,7 @@
throw new IllegalStateException(
this + " receives illegal id. Old id " + this.componentId + ", new id " + componentId);
}
- if (LOGGER.isLoggable(Level.INFO)) {
+ if (LOGGER.isInfoEnabled()) {
LOGGER.log(Level.INFO, "Component Id was reset from " + this.componentId + " to " + componentId);
}
this.componentId = componentId;
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/ComponentReplacementContext.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/ComponentReplacementContext.java
index 98c1560..ee7afa0 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/ComponentReplacementContext.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/ComponentReplacementContext.java
@@ -21,8 +21,6 @@
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.storage.am.common.ophelpers.IndexOperation;
@@ -37,9 +35,12 @@
import org.apache.hyracks.storage.common.ISearchOperationCallback;
import org.apache.hyracks.storage.common.ISearchPredicate;
import org.apache.hyracks.storage.common.MultiComparator;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class ComponentReplacementContext implements ILSMIndexOperationContext {
- private static final Logger LOGGER = Logger.getLogger(ComponentReplacementContext.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
private final List<ILSMComponent> components;
private final List<ILSMComponent> diskComponents;
private final List<ILSMComponentId> replacedComponentIds;
@@ -166,7 +167,7 @@
}
if (!found) {
// component has been merged?
- LOGGER.log(Level.WARNING, "Memory Component with id = " + replacedComponentIds.get(i)
+ LOGGER.log(Level.WARN, "Memory Component with id = " + replacedComponentIds.get(i)
+ " was flushed and merged before search cursor replaces it");
return false;
}
@@ -198,7 +199,7 @@
ctx.getComponentHolder().add(swapIndexes[i], diskComponents.get(i));
}
} catch (Exception e) {
- LOGGER.log(Level.WARNING, "Failure replacing memory components with disk components", e);
+ LOGGER.log(Level.WARN, "Failure replacing memory components with disk components", e);
throw e;
}
}
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/ExternalIndexHarness.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/ExternalIndexHarness.java
index 20f9f6a..d9d3a07 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/ExternalIndexHarness.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/ExternalIndexHarness.java
@@ -19,8 +19,6 @@
package org.apache.hyracks.storage.am.lsm.common.impls;
import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.hyracks.api.exceptions.ErrorCode;
import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -41,9 +39,11 @@
import org.apache.hyracks.storage.common.IIndexCursor;
import org.apache.hyracks.storage.common.ISearchPredicate;
import org.apache.hyracks.util.trace.ITracer;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class ExternalIndexHarness extends LSMHarness {
- private static final Logger LOGGER = Logger.getLogger(ExternalIndexHarness.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
public ExternalIndexHarness(ILSMIndex lsmIndex, ILSMMergePolicy mergePolicy, ILSMOperationTracker opTracker,
boolean replicationEnabled) {
@@ -230,7 +230,7 @@
@Override
public void merge(ILSMIndexOperationContext ctx, ILSMIOOperation operation) throws HyracksDataException {
- if (LOGGER.isLoggable(Level.INFO)) {
+ if (LOGGER.isInfoEnabled()) {
LOGGER.info("Started a merge operation for index: " + lsmIndex + " ...");
}
@@ -243,7 +243,7 @@
exitComponents(ctx, LSMOperationType.MERGE, newComponent, false);
operation.getCallback().afterFinalize(LSMIOOperationType.MERGE, newComponent);
}
- if (LOGGER.isLoggable(Level.INFO)) {
+ if (LOGGER.isInfoEnabled()) {
LOGGER.info("Finished the merge operation for index: " + lsmIndex);
}
}
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java
index 5368591..15ed0ff 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/LSMHarness.java
@@ -24,8 +24,6 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Predicate;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.hyracks.api.exceptions.ErrorCode;
import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -58,9 +56,12 @@
import org.apache.hyracks.storage.common.ISearchPredicate;
import org.apache.hyracks.util.trace.ITracer;
import org.apache.hyracks.util.trace.ITracer.Scope;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class LSMHarness implements ILSMHarness {
- private static final Logger LOGGER = Logger.getLogger(LSMHarness.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
protected final ILSMIndex lsmIndex;
protected final ComponentReplacementContext componentReplacementCtx;
@@ -195,8 +196,8 @@
}
entranceSuccessful = numEntered == components.size();
} catch (Throwable e) { // NOSONAR: Log and re-throw
- if (LOGGER.isLoggable(Level.SEVERE)) {
- LOGGER.log(Level.SEVERE, opType.name() + " failed to enter components on " + lsmIndex, e);
+ if (LOGGER.isErrorEnabled()) {
+ LOGGER.log(Level.ERROR, opType.name() + " failed to enter components on " + lsmIndex, e);
}
throw e;
} finally {
@@ -270,8 +271,8 @@
ctx.setAccessingComponents(false);
exitOperation(ctx, opType, newComponent, failedOperation);
} catch (Throwable e) { // NOSONAR: Log and re-throw
- if (LOGGER.isLoggable(Level.SEVERE)) {
- LOGGER.log(Level.SEVERE, e.getMessage(), e);
+ if (LOGGER.isErrorEnabled()) {
+ LOGGER.log(Level.ERROR, e.getMessage(), e);
}
throw e;
} finally {
@@ -324,8 +325,8 @@
c.deactivateAndDestroy();
}
} catch (Throwable e) { // NOSONAR Log and re-throw
- if (LOGGER.isLoggable(Level.WARNING)) {
- LOGGER.log(Level.WARNING, "Failure scheduling replication or destroying merged component", e);
+ if (LOGGER.isWarnEnabled()) {
+ LOGGER.log(Level.WARN, "Failure scheduling replication or destroying merged component", e);
}
throw e; // NOSONAR: The last call in the finally clause
}
@@ -557,7 +558,7 @@
@Override
public void flush(ILSMIndexOperationContext ctx, ILSMIOOperation operation) throws HyracksDataException {
- if (LOGGER.isLoggable(Level.INFO)) {
+ if (LOGGER.isInfoEnabled()) {
LOGGER.info("Started a flush operation for index: " + lsmIndex + " ...");
}
try {
@@ -569,8 +570,8 @@
newComponent.markAsValid(lsmIndex.isDurable());
} catch (Throwable e) { // NOSONAR Log and re-throw
failedOperation = true;
- if (LOGGER.isLoggable(Level.SEVERE)) {
- LOGGER.log(Level.SEVERE, "Flush failed on " + lsmIndex, e);
+ if (LOGGER.isErrorEnabled()) {
+ LOGGER.log(Level.ERROR, "Flush failed on " + lsmIndex, e);
}
throw e;
} finally {
@@ -586,7 +587,7 @@
opTracker.completeOperation(lsmIndex, LSMOperationType.FLUSH, ctx.getSearchOperationCallback(),
ctx.getModificationCallback());
}
- if (LOGGER.isLoggable(Level.INFO)) {
+ if (LOGGER.isInfoEnabled()) {
LOGGER.info("Finished the flush operation for index: " + lsmIndex);
}
}
@@ -618,7 +619,7 @@
@Override
public void merge(ILSMIndexOperationContext ctx, ILSMIOOperation operation) throws HyracksDataException {
- if (LOGGER.isLoggable(Level.INFO)) {
+ if (LOGGER.isInfoEnabled()) {
LOGGER.info("Started a merge operation for index: " + lsmIndex + " ...");
}
try {
@@ -631,8 +632,8 @@
newComponent.markAsValid(lsmIndex.isDurable());
} catch (Throwable e) { // NOSONAR: Log and re-throw
failedOperation = true;
- if (LOGGER.isLoggable(Level.SEVERE)) {
- LOGGER.log(Level.SEVERE, "Failed merge operation on " + lsmIndex, e);
+ if (LOGGER.isErrorEnabled()) {
+ LOGGER.log(Level.ERROR, "Failed merge operation on " + lsmIndex, e);
}
throw e;
} finally {
@@ -658,7 +659,7 @@
opTracker.completeOperation(lsmIndex, LSMOperationType.MERGE, ctx.getSearchOperationCallback(),
ctx.getModificationCallback());
}
- if (LOGGER.isLoggable(Level.INFO)) {
+ if (LOGGER.isInfoEnabled()) {
LOGGER.info("Finished the merge operation for index: " + lsmIndex);
}
}
@@ -751,8 +752,8 @@
processor.finish();
}
} catch (HyracksDataException e) {
- if (LOGGER.isLoggable(Level.SEVERE)) {
- LOGGER.log(Level.SEVERE, "Failed to process frame", e);
+ if (LOGGER.isErrorEnabled()) {
+ LOGGER.log(Level.ERROR, "Failed to process frame", e);
}
throw e;
} finally {
@@ -806,8 +807,8 @@
opTracker.wait();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
- if (LOGGER.isLoggable(Level.WARNING)) {
- LOGGER.log(Level.WARNING, "Ignoring interrupt while waiting for lagging merge on " + lsmIndex,
+ if (LOGGER.isWarnEnabled()) {
+ LOGGER.log(Level.WARN, "Ignoring interrupt while waiting for lagging merge on " + lsmIndex,
e);
}
}
@@ -891,7 +892,7 @@
try {
opTracker.wait(); // NOSONAR: OpTracker is always synchronized here
} catch (InterruptedException e) {
- LOGGER.log(Level.WARNING, "Interrupted while attempting component level delete", e);
+ LOGGER.log(Level.WARN, "Interrupted while attempting component level delete", e);
Thread.currentThread().interrupt();
throw HyracksDataException.create(e);
}
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/MemoryComponentMetadata.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/MemoryComponentMetadata.java
index 1b827b7..3179790 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/MemoryComponentMetadata.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/MemoryComponentMetadata.java
@@ -20,8 +20,6 @@
import java.util.ArrayList;
import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -31,9 +29,12 @@
import org.apache.hyracks.storage.am.common.api.IMetadataPageManager;
import org.apache.hyracks.storage.am.common.api.ITreeIndexMetadataFrame;
import org.apache.hyracks.storage.am.lsm.common.api.IComponentMetadata;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class MemoryComponentMetadata implements IComponentMetadata {
- private static final Logger LOGGER = Logger.getLogger(MemoryComponentMetadata.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
private static final byte[] empty = new byte[0];
private final List<org.apache.commons.lang3.tuple.Pair<IValueReference, ArrayBackedValueStorage>> store =
new ArrayList<>();
@@ -77,7 +78,7 @@
LOGGER.log(Level.INFO, "Copying Metadata into a different component");
ITreeIndexMetadataFrame frame = mdpManager.createMetadataFrame();
for (Pair<IValueReference, ArrayBackedValueStorage> pair : store) {
- if (LOGGER.isLoggable(Level.INFO)) {
+ if (LOGGER.isInfoEnabled()) {
LOGGER.log(Level.INFO, "Copying " + pair.getKey() + " : " + pair.getValue().getLength() + " bytes");
}
mdpManager.put(frame, pair.getKey(), pair.getValue());
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/SynchronousScheduler.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/SynchronousScheduler.java
index da3e986..506dcea 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/SynchronousScheduler.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/SynchronousScheduler.java
@@ -18,15 +18,15 @@
*/
package org.apache.hyracks.storage.am.lsm.common.impls;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperation;
import org.apache.hyracks.storage.am.lsm.common.api.ILSMIOOperationScheduler;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class SynchronousScheduler implements ILSMIOOperationScheduler {
- private static final Logger LOGGER = Logger.getLogger(SynchronousScheduler.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
public static final SynchronousScheduler INSTANCE = new SynchronousScheduler();
private SynchronousScheduler() {
@@ -37,7 +37,7 @@
try {
operation.call();
} catch (Exception e) {
- LOGGER.log(Level.SEVERE, "IO Operation failed", e);
+ LOGGER.log(Level.ERROR, "IO Operation failed", e);
throw HyracksDataException.create(e);
}
}
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/TracedIOOperation.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/TracedIOOperation.java
index 4cfc3b6..5fa6b4f 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/TracedIOOperation.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/TracedIOOperation.java
@@ -19,8 +19,6 @@
package org.apache.hyracks.storage.am.lsm.common.impls;
-import java.util.logging.Logger;
-
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.api.io.FileReference;
import org.apache.hyracks.api.io.IODeviceHandle;
@@ -29,10 +27,12 @@
import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndexAccessor;
import org.apache.hyracks.util.trace.ITracer;
import org.apache.hyracks.util.trace.ITracer.Scope;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
class TracedIOOperation implements ILSMIOOperation {
- static final Logger LOGGER = Logger.getLogger(TracedIOOperation.class.getName());
+ static final Logger LOGGER = LogManager.getLogger();
protected final ILSMIOOperation ioOp;
private final LSMIOOperationType ioOpType;
@@ -128,7 +128,7 @@
if (myIoOp instanceof Comparable && other instanceof ComparableTracedIOOperation) {
return ((Comparable) myIoOp).compareTo(((ComparableTracedIOOperation) other).getIoOp());
}
- LOGGER.warning("Comparing ioOps of type " + myIoOp.getClass().getSimpleName() + " and "
+ LOGGER.warn("Comparing ioOps of type " + myIoOp.getClass().getSimpleName() + " and "
+ other.getClass().getSimpleName() + " in " + getClass().getSimpleName());
return Integer.signum(hashCode() - other.hashCode());
}
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/VirtualBufferCache.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/VirtualBufferCache.java
index 3a22793..d192351 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/VirtualBufferCache.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/impls/VirtualBufferCache.java
@@ -25,8 +25,6 @@
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.hyracks.api.exceptions.ErrorCode;
import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -42,9 +40,12 @@
import org.apache.hyracks.storage.common.file.FileMapManager;
import org.apache.hyracks.storage.common.file.IFileMapManager;
import org.apache.hyracks.util.JSONUtil;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class VirtualBufferCache implements IVirtualBufferCache {
- private static final Logger LOGGER = Logger.getLogger(VirtualBufferCache.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
private final ICacheMemoryAllocator allocator;
private final IFileMapManager fileMapManager;
@@ -125,7 +126,7 @@
}
private void logStats() {
- if (LOGGER.isLoggable(Level.INFO)) {
+ if (LOGGER.isInfoEnabled()) {
LOGGER.log(Level.INFO, "Free (allocated) pages = " + freePages.size() + ". Budget = " + pageBudget
+ ". Large pages = " + largePages.get() + ". Overall usage = " + used.get());
}
@@ -187,7 +188,7 @@
bucket.bucketLock.unlock();
}
}
- if (LOGGER.isLoggable(Level.INFO)) {
+ if (LOGGER.isInfoEnabled()) {
LOGGER.log(Level.INFO, "Reclaimed pages = " + reclaimedPages);
}
logStats();
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/util/ComponentUtils.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/util/ComponentUtils.java
index 0097a37..94a3702 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/util/ComponentUtils.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/util/ComponentUtils.java
@@ -19,8 +19,6 @@
package org.apache.hyracks.storage.am.lsm.common.util;
import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.data.std.api.IPointable;
@@ -34,10 +32,13 @@
import org.apache.hyracks.storage.am.lsm.common.api.ILSMIndex;
import org.apache.hyracks.storage.am.lsm.common.api.ILSMMemoryComponent;
import org.apache.hyracks.storage.common.buffercache.IBufferCache;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class ComponentUtils {
- private static final Logger LOGGER = Logger.getLogger(ComponentUtils.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
public static final MutableArrayValueReference MARKER_LSN_KEY = new MutableArrayValueReference("Marker".getBytes());
public static final long NOT_FOUND = -1L;
@@ -76,40 +77,40 @@
* @throws HyracksDataException
*/
public static void get(ILSMIndex index, IValueReference key, IPointable pointable) throws HyracksDataException {
- boolean loggable = LOGGER.isLoggable(Level.FINE);
+ boolean loggable = LOGGER.isDebugEnabled();
if (loggable) {
- LOGGER.log(Level.FINE, "Getting " + key + " from index " + index);
+ LOGGER.log(Level.DEBUG, "Getting " + key + " from index " + index);
}
// Lock the opTracker to ensure index components don't change
synchronized (index.getOperationTracker()) {
index.getCurrentMemoryComponent().getMetadata().get(key, pointable);
if (pointable.getLength() == 0) {
if (loggable) {
- LOGGER.log(Level.FINE, key + " was not found in mutable memory component of " + index);
+ LOGGER.log(Level.DEBUG, key + " was not found in mutable memory component of " + index);
}
// was not found in the in current mutable component, search in the other in memory components
fromImmutableMemoryComponents(index, key, pointable);
if (pointable.getLength() == 0) {
if (loggable) {
- LOGGER.log(Level.FINE, key + " was not found in all immmutable memory components of " + index);
+ LOGGER.log(Level.DEBUG, key + " was not found in all immmutable memory components of " + index);
}
// was not found in the in all in memory components, search in the disk components
fromDiskComponents(index, key, pointable);
if (loggable) {
if (pointable.getLength() == 0) {
- LOGGER.log(Level.FINE, key + " was not found in all disk components of " + index);
+ LOGGER.log(Level.DEBUG, key + " was not found in all disk components of " + index);
} else {
- LOGGER.log(Level.FINE, key + " was found in disk components of " + index);
+ LOGGER.log(Level.DEBUG, key + " was found in disk components of " + index);
}
}
} else {
if (loggable) {
- LOGGER.log(Level.FINE, key + " was found in the immutable memory components of " + index);
+ LOGGER.log(Level.DEBUG, key + " was found in the immutable memory components of " + index);
}
}
} else {
if (loggable) {
- LOGGER.log(Level.FINE, key + " was found in mutable memory component of " + index);
+ LOGGER.log(Level.DEBUG, key + " was found in mutable memory component of " + index);
}
}
}
@@ -135,13 +136,13 @@
private static void fromDiskComponents(ILSMIndex index, IValueReference key, IPointable pointable)
throws HyracksDataException {
- boolean loggable = LOGGER.isLoggable(Level.FINE);
+ boolean loggable = LOGGER.isDebugEnabled();
if (loggable) {
- LOGGER.log(Level.FINE, "Getting " + key + " from disk components of " + index);
+ LOGGER.log(Level.DEBUG, "Getting " + key + " from disk components of " + index);
}
for (ILSMDiskComponent c : index.getDiskComponents()) {
if (loggable) {
- LOGGER.log(Level.FINE, "Getting " + key + " from disk components " + c);
+ LOGGER.log(Level.DEBUG, "Getting " + key + " from disk components " + c);
}
c.getMetadata().get(key, pointable);
if (pointable.getLength() != 0) {
@@ -152,19 +153,20 @@
}
private static void fromImmutableMemoryComponents(ILSMIndex index, IValueReference key, IPointable pointable) {
- boolean loggable = LOGGER.isLoggable(Level.FINE);
+ boolean loggable = LOGGER.isDebugEnabled();
if (loggable) {
- LOGGER.log(Level.FINE, "Getting " + key + " from immutable memory components of " + index);
+ LOGGER.log(Level.DEBUG, "Getting " + key + " from immutable memory components of " + index);
}
List<ILSMMemoryComponent> memComponents = index.getMemoryComponents();
int numOtherMemComponents = memComponents.size() - 1;
int next = index.getCurrentMemoryComponentIndex();
if (loggable) {
- LOGGER.log(Level.FINE, index + " has " + numOtherMemComponents + " immutable memory components");
+ LOGGER.log(Level.DEBUG, index + " has " + numOtherMemComponents + " immutable memory components");
}
for (int i = 0; i < numOtherMemComponents; i++) {
if (loggable) {
- LOGGER.log(Level.FINE, "trying to get " + key + " from immutable memory components number: " + (i + 1));
+ LOGGER.log(Level.DEBUG,
+ "trying to get " + key + " from immutable memory components number: " + (i + 1));
}
next = next - 1;
if (next < 0) {
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/util/IOOperationUtils.java b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/util/IOOperationUtils.java
index 0aeb0b9..9bd873d 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/util/IOOperationUtils.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-lsm-common/src/main/java/org/apache/hyracks/storage/am/lsm/common/util/IOOperationUtils.java
@@ -18,14 +18,14 @@
*/
package org.apache.hyracks.storage.am.lsm.common.util;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.storage.am.lsm.common.impls.BlockingIOOperationCallbackWrapper;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class IOOperationUtils {
- private static final Logger LOGGER = Logger.getLogger(IOOperationUtils.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
private IOOperationUtils() {
}
@@ -35,7 +35,7 @@
try {
ioCallback.waitForIO();
} catch (InterruptedException e) {
- LOGGER.log(Level.WARNING, "Operation has been interrupted. returning");
+ LOGGER.log(Level.WARN, "Operation has been interrupted. returning");
Thread.currentThread().interrupt();
throw HyracksDataException.create(e);
}