accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [1/2] git commit: ACCUMULO-2902 Move the configuration of the date format from code into a Property
Date Mon, 16 Jun 2014 18:06:41 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master 981bf5326 -> c9ed279f3


ACCUMULO-2902 Move the configuration of the date format from code into a Property


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/33ffd6fc
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/33ffd6fc
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/33ffd6fc

Branch: refs/heads/master
Commit: 33ffd6fcf031b2de6ba406ee6ab411d8225ed37e
Parents: 981bf53
Author: Josh Elser <elserj@apache.org>
Authored: Mon Jun 16 10:44:36 2014 -0700
Committer: Josh Elser <elserj@apache.org>
Committed: Mon Jun 16 10:44:36 2014 -0700

----------------------------------------------------------------------
 .../java/org/apache/accumulo/core/conf/Property.java  |  2 ++
 .../apache/accumulo/monitor/servlets/LogServlet.java  | 14 +++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/33ffd6fc/core/src/main/java/org/apache/accumulo/core/conf/Property.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/conf/Property.java b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
index e35a9c3..a58dfe9 100644
--- a/core/src/main/java/org/apache/accumulo/core/conf/Property.java
+++ b/core/src/main/java/org/apache/accumulo/core/conf/Property.java
@@ -319,6 +319,8 @@ public enum Property {
 
   MONITOR_LOCK_CHECK_INTERVAL("monitor.lock.check.interval", "5s", PropertyType.TIMEDURATION,
       "The amount of time to sleep between checking for the Montior ZooKeeper lock"),
+  MONITOR_LOG_DATE_FORMAT("monitor.log.date.format", "yyyy/MM/dd HH:mm:ss,SSSS", PropertyType.STRING,
"The SimpleDateFormat string used to configure "
+      + "the date shown on the 'Recent Logs' monitor page"),
 
   TRACE_PREFIX("trace.", null, PropertyType.PREFIX, "Properties in this category affect the
behavior of distributed tracing."),
   TRACE_PORT("trace.port.client", "12234", PropertyType.PORT, "The listening port for the
trace server"),

http://git-wip-us.apache.org/repos/asf/accumulo/blob/33ffd6fc/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/LogServlet.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/LogServlet.java
b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/LogServlet.java
index 268c883..f877664 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/LogServlet.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/servlets/LogServlet.java
@@ -21,6 +21,9 @@ import java.text.SimpleDateFormat;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.accumulo.core.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.monitor.Monitor;
 import org.apache.accumulo.monitor.util.Table;
 import org.apache.accumulo.monitor.util.celltypes.DateTimeType;
 import org.apache.accumulo.monitor.util.celltypes.StringType;
@@ -40,8 +43,17 @@ public class LogServlet extends BasicServlet {
   
   @Override
   protected void pageBody(HttpServletRequest req, HttpServletResponse resp, StringBuilder
sb) {
+    AccumuloConfiguration conf = Monitor.getSystemConfiguration();
     boolean clear = true;
-    SimpleDateFormat fmt = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss,SSSS");
+    final String dateFormatStr = conf.get(Property.MONITOR_LOG_DATE_FORMAT);
+    SimpleDateFormat fmt;
+    try {
+      fmt = new SimpleDateFormat(dateFormatStr);
+    } catch (IllegalArgumentException e) {
+      log.warn("Could not instantiate SimpleDateFormat with format string of '" + dateFormatStr
+ "', using default format string");
+      fmt = new SimpleDateFormat(Property.MONITOR_LOG_DATE_FORMAT.getDefaultValue());
+    }
+
     Table logTable = new Table("logTable", "Recent&nbsp;Logs");
     logTable.addSortableColumn("Time", new DateTimeType(fmt), null);
     logTable.addSortableColumn("Application");


Mime
View raw message