HADOOP-7434. Display error when using "daemonlog -setlevel" with illegal level. Contributed by yanjinshuang

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1147966 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2011-07-18 16:49:00 +00:00
parent 8a77d0b289
commit 0a84abfed0
2 changed files with 9 additions and 2 deletions

View File

@ -272,6 +272,9 @@ Trunk (unreleased changes)
HADOOP-7465. A several tiny improvements for the LOG format.
(Xie Xianshan via eli)
HADOOP-7434. Display error when using "daemonlog -setlevel" with
illegal level. (yanjinshuang via eli)
OPTIMIZATIONS
HADOOP-7333. Performance improvement in PureJavaCrc32. (Eric Caspole

View File

@ -142,8 +142,12 @@ public class LogLevel {
private static void process(org.apache.log4j.Logger log, String level,
PrintWriter out) throws IOException {
if (level != null) {
log.setLevel(org.apache.log4j.Level.toLevel(level));
out.println(MARKER + "Setting Level to " + level + " ...<br />");
if (!level.equals(org.apache.log4j.Level.toLevel(level).toString())) {
out.println(MARKER + "Bad level : <b>" + level + "</b><br />");
} else {
log.setLevel(org.apache.log4j.Level.toLevel(level));
out.println(MARKER + "Setting Level to " + level + " ...<br />");
}
}
out.println(MARKER
+ "Effective level: <b>" + log.getEffectiveLevel() + "</b><br />");