[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-util/pom.xml b/hyracks-fullstack/hyracks/hyracks-util/pom.xml
index 419166b..52ccf2f 100644
--- a/hyracks-fullstack/hyracks/hyracks-util/pom.xml
+++ b/hyracks-fullstack/hyracks/hyracks-util/pom.xml
@@ -71,6 +71,10 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ </dependency>
</dependencies>
</project>
diff --git a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/DiskUtil.java b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/DiskUtil.java
index 9a65d72..a1f9346 100644
--- a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/DiskUtil.java
+++ b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/DiskUtil.java
@@ -24,14 +24,15 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.logging.Level;
-import java.util.logging.Logger;
import org.apache.commons.lang3.SystemUtils;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class DiskUtil {
- private static final Logger LOGGER = Logger.getLogger(DiskUtil.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
private DiskUtil() {
throw new AssertionError("Util class should not be initialized.");
@@ -119,7 +120,7 @@
LOGGER.info(line);
}
} catch (IOException e) {
- LOGGER.log(Level.WARNING, e.getMessage(), e);
+ LOGGER.log(Level.WARN, e.getMessage(), e);
}
}).start();
}
diff --git a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ExitUtil.java b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ExitUtil.java
index b039227..c54c9dc 100644
--- a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ExitUtil.java
+++ b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/ExitUtil.java
@@ -18,12 +18,13 @@
*/
package org.apache.hyracks.util;
-import java.util.logging.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
@SuppressWarnings("squid:S1147")
public class ExitUtil {
- private static final Logger LOGGER = Logger.getLogger(ExitUtil.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
private static final ExitThread exitThread = new ExitThread();
diff --git a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/JSONUtil.java b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/JSONUtil.java
index dcdf140..158ab66 100644
--- a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/JSONUtil.java
+++ b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/JSONUtil.java
@@ -23,7 +23,9 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
-import java.util.logging.Logger;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
@@ -34,7 +36,7 @@
public class JSONUtil {
- private static final Logger LOGGER = Logger.getLogger(JSONUtil.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
private static final String INDENT = "\t";
@@ -63,8 +65,8 @@
try {
return appendObj(new StringBuilder(), om.readTree(str), initialIndent).toString();
} catch (IOException e) {
- LOGGER.finest(String.valueOf(e));
- LOGGER.finest("Could not indent JSON string, returning the input string: " + str);
+ LOGGER.trace(String.valueOf(e));
+ LOGGER.trace("Could not indent JSON string, returning the input string: " + str);
return str;
}
}
diff --git a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/PidHelper.java b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/PidHelper.java
index 410097e..5a8edbd 100644
--- a/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/PidHelper.java
+++ b/hyracks-fullstack/hyracks/hyracks-util/src/main/java/org/apache/hyracks/util/PidHelper.java
@@ -22,12 +22,14 @@
import java.lang.management.RuntimeMXBean;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
-import java.util.logging.Level;
-import java.util.logging.Logger;
+
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
public class PidHelper {
- private static final Logger LOGGER = Logger.getLogger(PidHelper.class.getName());
+ private static final Logger LOGGER = LogManager.getLogger();
private PidHelper() {
}