asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "abdullah alamoudi (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: Add Timestamp to Feed Logs
Date Fri, 29 Apr 2016 17:03:25 GMT
abdullah alamoudi has submitted this change and it was merged.

Change subject: Add Timestamp to Feed Logs
......................................................................


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>
---
M asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/FeedLogManager.java
1 file changed, 12 insertions(+), 1 deletion(-)

Approvals:
  Murtadha Hubail: Looks good to me, approved
  Jenkins: Verified



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.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 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 @@
     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 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 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 @@
         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());

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/833
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3bb8bb0679108d1eba879d18af1e2119fe7e336a
Gerrit-PatchSet: 2
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: abdullah alamoudi <bamousaa@gmail.com>
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Murtadha Hubail <hubailmor@gmail.com>
Gerrit-Reviewer: abdullah alamoudi <bamousaa@gmail.com>

Mime
View raw message