HBASE-20577 Make Log Level page design consistent with the design of other pages in UI
Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
parent
acbc3a2253
commit
60bdaf7846
|
@ -105,13 +105,17 @@ public final class LogLevel {
|
|||
response)) {
|
||||
return;
|
||||
}
|
||||
response.setContentType("text/html");
|
||||
String requestedURL = "header.jsp?pageTitle=Log Level";
|
||||
request.getRequestDispatcher(requestedURL).include(request, response);
|
||||
PrintWriter out = response.getWriter();
|
||||
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 />");
|
||||
|
||||
|
@ -132,28 +136,42 @@ public final class LogLevel {
|
|||
out.println("Sorry, " + log.getClass() + " not supported.<br />");
|
||||
}
|
||||
}
|
||||
|
||||
out.println(FORMS);
|
||||
out.println(ServletUtil.HTML_TAIL);
|
||||
out.println("</div>");
|
||||
request.getRequestDispatcher("footer.jsp").include(request, response);
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue