[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-common/pom.xml b/hyracks-fullstack/hyracks/hyracks-storage-am-common/pom.xml
index 2b3f3cb..1d52034 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-common/pom.xml
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-common/pom.xml
@@ -90,5 +90,9 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ </dependency>
</dependencies>
</project>
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/build/IndexBuilder.java b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/build/IndexBuilder.java
index 9f648c5..f62860a 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/build/IndexBuilder.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/build/IndexBuilder.java
@@ -19,8 +19,6 @@
package org.apache.hyracks.storage.am.common.build;
import java.io.IOException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.hyracks.api.application.INCServiceContext;
import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -36,9 +34,12 @@
import org.apache.hyracks.storage.common.IStorageManager;
import org.apache.hyracks.storage.common.LocalResource;
import org.apache.hyracks.storage.common.file.IResourceIdFactory;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class IndexBuilder implements IIndexBuilder {
- private static final Logger LOGGER = Logger.getLogger(IndexBuilder.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
protected final INCServiceContext ctx;
protected final IStorageManager storageManager;
@@ -85,7 +86,7 @@
//The reason for this is to handle many cases such as:
//1. Crash while delete index is running (we don't do global cleanup on restart)
//2. Node leaves and then join with old data
- LOGGER.log(Level.WARNING,
+ LOGGER.log(Level.WARN,
"Removing existing index on index create for the index: " + resourceRef.getRelativePath());
lcManager.unregister(resourceRef.getRelativePath());
index.destroy();
@@ -95,7 +96,7 @@
// This is another big problem that we need to disallow soon
// We can only disallow this if we have a global cleanup after crash
// on reboot
- LOGGER.log(Level.WARNING,
+ LOGGER.log(Level.WARN,
"Deleting " + resourceRef.getRelativePath()
+ " on index create. The index is not registered"
+ " but the file exists in the filesystem");
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexDataflowHelper.java b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexDataflowHelper.java
index abfe0bb..520dbc0 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexDataflowHelper.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexDataflowHelper.java
@@ -19,9 +19,6 @@
package org.apache.hyracks.storage.am.common.dataflow;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
import org.apache.hyracks.api.application.INCServiceContext;
import org.apache.hyracks.api.exceptions.ErrorCode;
import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -33,10 +30,13 @@
import org.apache.hyracks.storage.common.IResourceLifecycleManager;
import org.apache.hyracks.storage.common.IStorageManager;
import org.apache.hyracks.storage.common.LocalResource;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class IndexDataflowHelper implements IIndexDataflowHelper {
- private static final Logger LOGGER = Logger.getLogger(IndexDataflowHelper.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
private final INCServiceContext ctx;
private final IResourceLifecycleManager<IIndex> lcManager;
private final ILocalResourceRepository localResourceRepository;
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexDropOperatorNodePushable.java b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexDropOperatorNodePushable.java
index ea1635a..c59c1a8 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexDropOperatorNodePushable.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexDropOperatorNodePushable.java
@@ -27,8 +27,6 @@
import java.util.Set;
import java.util.concurrent.TimeUnit;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.hyracks.api.comm.IFrameWriter;
import org.apache.hyracks.api.context.IHyracksTaskContext;
@@ -36,10 +34,12 @@
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.dataflow.std.base.AbstractOperatorNodePushable;
import org.apache.hyracks.storage.am.common.api.IIndexDataflowHelper;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class IndexDropOperatorNodePushable extends AbstractOperatorNodePushable {
- private static final Logger LOGGER = Logger.getLogger(IndexDropOperatorNodePushable.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
private static final long DROP_ATTEMPT_WAIT_TIME_MILLIS = TimeUnit.SECONDS.toMillis(1);
private final IIndexDataflowHelper indexHelper;
private final Set<DropOption> options;
@@ -83,11 +83,11 @@
return;
} catch (HyracksDataException e) {
if (isIgnorable(e)) {
- LOGGER.log(Level.INFO, e, () -> "Ignoring exception on drop");
+ LOGGER.info("Ignoring exception on drop", e);
return;
}
if (canRetry(e)) {
- LOGGER.log(Level.INFO, e, () -> "Retrying drop on exception");
+ LOGGER.info( "Retrying drop on exception", e);
continue;
}
throw e;
diff --git a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexSearchOperatorNodePushable.java b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexSearchOperatorNodePushable.java
index 132149b..1e5f69b 100644
--- a/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexSearchOperatorNodePushable.java
+++ b/hyracks-fullstack/hyracks/hyracks-storage-am-common/src/main/java/org/apache/hyracks/storage/am/common/dataflow/IndexSearchOperatorNodePushable.java
@@ -21,8 +21,6 @@
import java.io.DataOutput;
import java.io.IOException;
import java.nio.ByteBuffer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.hyracks.api.comm.VSizeFrame;
import org.apache.hyracks.api.context.IHyracksTaskContext;
@@ -50,10 +48,13 @@
import org.apache.hyracks.storage.common.IIndexCursor;
import org.apache.hyracks.storage.common.ISearchOperationCallback;
import org.apache.hyracks.storage.common.ISearchPredicate;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public abstract class IndexSearchOperatorNodePushable extends AbstractUnaryInputUnaryOutputOperatorNodePushable {
- static final Logger LOGGER = Logger.getLogger(IndexSearchOperatorNodePushable.class.getName());
+ static final Logger LOGGER = LogManager.getLogger();
protected final IHyracksTaskContext ctx;
protected final IIndexDataflowHelper indexHelper;
protected FrameTupleAccessor accessor;
@@ -299,7 +300,7 @@
try {
nonMatchWriter.writeMissing(out);
} catch (Exception e) {
- LOGGER.log(Level.WARNING, e.getMessage(), e);
+ LOGGER.log(Level.WARN, e.getMessage(), e);
}
nullTuple.addFieldEndOffset();
}