hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zhang...@apache.org
Subject [hbase] branch branch-2.2 updated: HBASE-21830 Backport HBASE-20577 (Make Log Level page design consistent with the design of other pages in UI) to branch-2
Date Sun, 03 Feb 2019 07:12:36 GMT
This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch branch-2.2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.2 by this push:
     new 33b87d6  HBASE-21830 Backport HBASE-20577 (Make Log Level page design consistent
with the design of other pages in UI) to branch-2
33b87d6 is described below

commit 33b87d67ebc242253a2f1dbb9c826e1ffde53420
Author: Nihal Jain <nihaljain.cs@gmail.com>
AuthorDate: Sat Feb 2 17:09:39 2019 +0530

    HBASE-21830 Backport HBASE-20577 (Make Log Level page design consistent with the design
of other pages in UI) to branch-2
    
    Signed-off-by: zhangduo <zhangduo@apache.org>
---
 .../org/apache/hadoop/hbase/http/log/LogLevel.java | 59 +++++++++++++++++-----
 1 file changed, 45 insertions(+), 14 deletions(-)

diff --git a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/log/LogLevel.java b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/log/LogLevel.java
index 2f62313..cb23421 100644
--- a/hbase-http/src/main/java/org/apache/hadoop/hbase/http/log/LogLevel.java
+++ b/hbase-http/src/main/java/org/apache/hadoop/hbase/http/log/LogLevel.java
@@ -18,6 +18,7 @@
 package org.apache.hadoop.hbase.http.log;
 
 import java.io.BufferedReader;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.PrintWriter;
@@ -105,13 +106,23 @@ public final class LogLevel {
           response)) {
         return;
       }
+      response.setContentType("text/html");
+      PrintWriter out;
+      try {
+        String headerPath = "header.jsp?pageTitle=Log Level";
+        request.getRequestDispatcher(headerPath).include(request, response);
+        out = response.getWriter();
+      } catch (FileNotFoundException e) {
+        // in case file is not found fall back to old design
+        out = ServletUtil.initHTML(response, "Log Level");
+      }
+      out.println(FORMS);
 
-      PrintWriter out = ServletUtil.initHTML(response, "Log Level");
       String logName = ServletUtil.getParameter(request, "log");
       String level = ServletUtil.getParameter(request, "level");
 
       if (logName != null) {
-        out.println("<br /><hr /><h3>Results</h3>");
+        out.println("<p>Results:</p>");
         out.println(MARKER
             + "Submitted Log Name: <b>" + logName + "</b><br />");
 
@@ -133,27 +144,47 @@ public final class LogLevel {
         }
       }
 
-      out.println(FORMS);
-      out.println(ServletUtil.HTML_TAIL);
+      try {
+        String footerPath = "footer.jsp";
+        out.println("</div>");
+        request.getRequestDispatcher(footerPath).include(request, response);
+      } catch (FileNotFoundException e) {
+        out.println(ServletUtil.HTML_TAIL);
+      }
+      out.close();
     }
 
-    static final String FORMS = "\n<br /><hr /><h3>Get / Set</h3>"
-        + "\n<form>Log: <input type='text' size='50' name='log' /> "
-        + "<input type='submit' value='Get Log Level' />"
-        + "</form>"
-        + "\n<form>Log: <input type='text' size='50' name='log' /> "
-        + "Level: <input type='text' name='level' /> "
-        + "<input type='submit' value='Set Log Level' />"
-        + "</form>";
+    static final String FORMS = "<div class='container-fluid content'>\n"
+        + "<div class='row inner_header'>\n" + "<div class='page-header'>\n"
+        + "<h1>Get/Set Log Level</h1>\n" + "</div>\n" + "</div>\n"
+ "Actions:" + "<p>"
+        + "<center>\n" + "<table class='table' style='border: 0;' width='95%' >\n"
+ "<tr>\n"
+        + "<form>\n" + "<td class='centered'>\n"
+        + "<input style='font-size: 12pt; width: 10em' type='submit' value='Get Log Level'"
+        + " class='btn' />\n" + "</td>\n" + "<td style='text-align: center;'>\n"
+        + "<input type='text' name='log' size='50' required='required'"
+        + " placeholder='Log Name (required)' />\n" + "</td>\n" + "<td width=\"40%\">"
+        + "Get the current log level for the specified log name." + "</td>\n" + "</form>\n"
+        + "</tr>\n" + "<tr>\n" + "<form>\n" + "<td class='centered'>\n"
+        + "<input style='font-size: 12pt; width: 10em' type='submit'"
+        + " value='Set Log Level' class='btn' />\n" + "</td>\n"
+        + "<td style='text-align: center;'>\n"
+        + "<input type='text' name='log' size='50' required='required'"
+        + " placeholder='Log Name (required)' />\n"
+        + "<input type='text' name='level' size='50' required='required'"
+        + " placeholder='Log Level (required)' />\n" + "</td>\n" + "<td width=\"40%\"
style=\"\">"
+        + "Set the specified log level for the specified log name." + "</td>\n" + "</form>\n"
+        + "</tr>\n" + "</table>\n" + "</center>\n" + "</p>\n" + "<hr/>\n";
 
     private static void process(org.apache.log4j.Logger log, String level,
         PrintWriter out) throws IOException {
       if (level != null) {
         if (!level.equals(org.apache.log4j.Level.toLevel(level).toString())) {
-          out.println(MARKER + "Bad level : <b>" + level + "</b><br />");
+          out.println(MARKER + "<div class='text-danger'>" + "Bad level : <strong>"
+ level
+              + "</strong><br />" + "</div>");
         } else {
           log.setLevel(org.apache.log4j.Level.toLevel(level));
-          out.println(MARKER + "Setting Level to " + level + " ...<br />");
+          out.println(MARKER + "<div class='text-success'>" + "Setting Level to <strong>"
+ level
+              + "</strong> ...<br />" + "</div>");
         }
       }
       out.println(MARKER


Mime
View raw message