asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amo...@apache.org
Subject incubator-asterixdb git commit: Add Timestamp to Feed Logs
Date Fri, 29 Apr 2016 17:04:50 GMT
Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master e964f9b80 -> 6fa914e03


Add Timestamp to Feed Logs

As per the request of users. This will help determine the time it
takes to ingest data.

Change-Id: I3bb8bb0679108d1eba879d18af1e2119fe7e336a
Reviewed-on: https://asterix-gerrit.ics.uci.edu/833
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Murtadha Hubail <hubailmor@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/commit/6fa914e0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/tree/6fa914e0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/diff/6fa914e0

Branch: refs/heads/master
Commit: 6fa914e03e9b28f9febde9d65111638f386cb64f
Parents: e964f9b
Author: Abdullah Alamoudi <bamousaa@gmail.com>
Authored: Tue Apr 26 16:58:25 2016 +0300
Committer: abdullah alamoudi <bamousaa@gmail.com>
Committed: Fri Apr 29 10:03:24 2016 -0700

----------------------------------------------------------------------
 .../apache/asterix/external/util/FeedLogManager.java   | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/6fa914e0/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/FeedLogManager.java
----------------------------------------------------------------------
diff --git a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/FeedLogManager.java
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/FeedLogManager.java
index 5bb8ec3..9d887b6 100644
--- a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/FeedLogManager.java
+++ b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/FeedLogManager.java
@@ -27,6 +27,9 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.StandardOpenOption;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
 import java.util.TreeSet;
 
 import org.apache.commons.io.FileUtils;
@@ -46,7 +49,8 @@ public class FeedLogManager {
     public static final String BAD_RECORDS_FILE_NAME = "failed_record.log";
     public static final String START_PREFIX = "s:";
     public static final String END_PREFIX = "e:";
-    public static final int PREFIX_SIZE = 2;
+    private static final String DATE_FORMAT_STRING = "MM/dd/yyyy HH:mm:ss";
+    public static final int PREFIX_SIZE = START_PREFIX.length() + DATE_FORMAT_STRING.length()
+ 1;
     private String currentPartition;
     private final TreeSet<String> completed;
     private final Path dir;
@@ -55,6 +59,7 @@ public class FeedLogManager {
     private BufferedWriter recordLogger;
     private final StringBuilder stringBuilder = new StringBuilder();
     private int count = 0;
+    private static final DateFormat df = new SimpleDateFormat(DATE_FORMAT_STRING);
 
     public FeedLogManager(File file) throws HyracksDataException {
         try {
@@ -144,6 +149,8 @@ public class FeedLogManager {
 
     public synchronized void logProgress(String log) throws IOException {
         stringBuilder.setLength(0);
+        stringBuilder.append(df.format((new Date())));
+        stringBuilder.append(' ');
         stringBuilder.append(log);
         stringBuilder.append(ExternalDataConstants.LF);
         progressLogger.write(stringBuilder.toString());
@@ -152,6 +159,8 @@ public class FeedLogManager {
 
     public synchronized void logError(String error, Throwable th) throws IOException {
         stringBuilder.setLength(0);
+        stringBuilder.append(df.format((new Date())));
+        stringBuilder.append(' ');
         stringBuilder.append(error);
         stringBuilder.append(ExternalDataConstants.LF);
         stringBuilder.append(th.toString());
@@ -164,6 +173,8 @@ public class FeedLogManager {
         stringBuilder.setLength(0);
         stringBuilder.append(record);
         stringBuilder.append(ExternalDataConstants.LF);
+        stringBuilder.append(df.format((new Date())));
+        stringBuilder.append(' ');
         stringBuilder.append(errorMessage);
         stringBuilder.append(ExternalDataConstants.LF);
         recordLogger.write(stringBuilder.toString());


Mime
View raw message