[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-dataflow-common/pom.xml b/hyracks-fullstack/hyracks/hyracks-dataflow-common/pom.xml
index f44ed74..5088719 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-common/pom.xml
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-common/pom.xml
@@ -79,6 +79,10 @@
<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-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/comm/io/FrameDeserializer.java b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/comm/io/FrameDeserializer.java
index 819d751..5a39523 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/comm/io/FrameDeserializer.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/comm/io/FrameDeserializer.java
@@ -21,16 +21,16 @@
import java.io.DataInputStream;
import java.io.IOException;
import java.nio.ByteBuffer;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.hyracks.api.comm.FrameConstants;
import org.apache.hyracks.api.dataflow.value.RecordDescriptor;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.dataflow.common.comm.util.ByteBufferInputStream;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class FrameDeserializer {
- private static final Logger LOGGER = Logger.getLogger(FrameDeserializer.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
private final ByteBufferInputStream bbis;
@@ -70,8 +70,8 @@
Object[] record = new Object[recordDescriptor.getFieldCount()];
for (int i = 0; i < record.length; ++i) {
Object instance = recordDescriptor.getFields()[i].deserialize(di);
- if (LOGGER.isLoggable(Level.FINEST)) {
- LOGGER.finest(i + " " + instance);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(i + " " + instance);
}
record[i] = instance;
if (FrameConstants.DEBUG_FRAME_IO) {
@@ -84,8 +84,8 @@
}
}
}
- if (LOGGER.isLoggable(Level.FINEST)) {
- LOGGER.finest("Read Record tIndex = " + tIndex + ", tupleCount = " + tupleCount);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("Read Record tIndex = " + tIndex + ", tupleCount = " + tupleCount);
}
++tIndex;
return record;
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/comm/io/FrameOutputStream.java b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/comm/io/FrameOutputStream.java
index e8f826f..d3af00d 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/comm/io/FrameOutputStream.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/comm/io/FrameOutputStream.java
@@ -18,16 +18,15 @@
*/
package org.apache.hyracks.dataflow.common.comm.io;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
import org.apache.hyracks.api.comm.IFrame;
import org.apache.hyracks.api.comm.IFrameWriter;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.data.std.util.ByteArrayAccessibleOutputStream;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class FrameOutputStream extends ByteArrayAccessibleOutputStream {
- private static final Logger LOGGER = Logger.getLogger(FrameOutputStream.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
private final FrameTupleAppender frameTupleAppender;
@@ -42,15 +41,15 @@
public int getTupleCount() {
int tupleCount = frameTupleAppender.getTupleCount();
- if (LOGGER.isLoggable(Level.FINEST)) {
- LOGGER.finest("appendTuple(): tuple count: " + tupleCount);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("appendTuple(): tuple count: " + tupleCount);
}
return tupleCount;
}
public boolean appendTuple() throws HyracksDataException {
- if (LOGGER.isLoggable(Level.FINEST)) {
- LOGGER.finest("appendTuple(): tuple size: " + count);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace("appendTuple(): tuple size: " + count);
}
boolean appended = frameTupleAppender.append(buf, 0, count);
count = 0;
diff --git a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/comm/io/SerializingDataWriter.java b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/comm/io/SerializingDataWriter.java
index d9a4c7c..f7b5e3b 100644
--- a/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/comm/io/SerializingDataWriter.java
+++ b/hyracks-fullstack/hyracks/hyracks-dataflow-common/src/main/java/org/apache/hyracks/dataflow/common/comm/io/SerializingDataWriter.java
@@ -18,9 +18,6 @@
*/
package org.apache.hyracks.dataflow.common.comm.io;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
import org.apache.hyracks.api.comm.IFrameWriter;
import org.apache.hyracks.api.comm.VSizeFrame;
import org.apache.hyracks.api.context.IHyracksTaskContext;
@@ -28,9 +25,11 @@
import org.apache.hyracks.api.dataflow.value.RecordDescriptor;
import org.apache.hyracks.api.exceptions.HyracksDataException;
import org.apache.hyracks.dataflow.common.comm.util.FrameUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class SerializingDataWriter implements IOpenableDataWriter<Object[]> {
- private static final Logger LOGGER = Logger.getLogger(SerializingDataWriter.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
private final ArrayTupleBuilder tb;
@@ -82,8 +81,8 @@
tb.reset();
for (int i = 0; i < data.length; ++i) {
Object instance = data[i];
- if (LOGGER.isLoggable(Level.FINEST)) {
- LOGGER.finest(i + " " + instance);
+ if (LOGGER.isTraceEnabled()) {
+ LOGGER.trace(i + " " + instance);
}
tb.addField(recordDescriptor.getFields()[i], instance);
}