Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2012-07-26 23:24:25 +0000
committerGreg Wilkins2012-07-27 05:45:12 +0000
commitc7c4c6e13b4856d1ea0740384d750341c9397a5e (patch)
tree8c15bf9fc403dbaae1e8795e295391f59915ea90
parent748f06cad7901d7a54d33bfba4f45e67993b73b4 (diff)
downloadorg.eclipse.jetty.project-c7c4c6e13b4856d1ea0740384d750341c9397a5e.tar.gz
org.eclipse.jetty.project-c7c4c6e13b4856d1ea0740384d750341c9397a5e.tar.xz
org.eclipse.jetty.project-c7c4c6e13b4856d1ea0740384d750341c9397a5e.zip
379207 backported fixes from jetty-9 to make hierarchy work
-rw-r--r--jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java10
-rw-r--r--jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrLogTest.java14
2 files changed, 19 insertions, 5 deletions
diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java b/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java
index 7636bd870d..51d248d6a0 100644
--- a/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java
+++ b/jetty-util/src/main/java/org/eclipse/jetty/util/log/StdErrLog.java
@@ -331,8 +331,8 @@ public class StdErrLog extends AbstractLogger
this._level = LEVEL_DEBUG;
for (Logger log : Log.getLoggers().values())
- {
- if (log instanceof StdErrLog)
+ {
+ if (log.getName().startsWith(getName()) && log instanceof StdErrLog)
((StdErrLog)log).setLevel(LEVEL_DEBUG);
}
}
@@ -342,7 +342,7 @@ public class StdErrLog extends AbstractLogger
for (Logger log : Log.getLoggers().values())
{
- if (log instanceof StdErrLog)
+ if (log.getName().startsWith(getName()) && log instanceof StdErrLog)
((StdErrLog)log).setLevel(((StdErrLog)log)._configuredLevel);
}
}
@@ -572,6 +572,10 @@ public class StdErrLog extends AbstractLogger
// Let Level come from configured Properties instead - sel.setLevel(_level);
logger.setSource(_source);
logger._stderr = this._stderr;
+
+ // Force the child to have any programmatic configuration
+ if (_level!=_configuredLevel)
+ logger._level=_level;
return logger;
}
diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrLogTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrLogTest.java
index c902f10cea..c34745a5c0 100644
--- a/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrLogTest.java
+++ b/jetty-util/src/test/java/org/eclipse/jetty/util/log/StdErrLogTest.java
@@ -69,18 +69,28 @@ public class StdErrLogTest
log.debug("YOU SHOULD NOT SEE THIS!",null,null);
// Test for backward compat with old (now deprecated) method
+ Logger before = log.getLogger("before");
log.setDebugEnabled(true);
+ Logger after = log.getLogger("after");
+ before.debug("testing {} {}","test","debug-before");
log.debug("testing {} {}","test","debug-deprecated");
+ after.debug("testing {} {}","test","debug-after");
log.setDebugEnabled(false);
+ before.debug("testing {} {}","test","debug-before-false");
log.debug("testing {} {}","test","debug-deprecated-false");
-
+ after.debug("testing {} {}","test","debug-after-false");
+
output.assertContains("DBUG:xxx:testing test debug");
output.assertContains("INFO:xxx:testing test info");
output.assertContains("WARN:xxx:testing test warn");
output.assertNotContains("YOU SHOULD NOT SEE THIS!");
+ output.assertContains("DBUG:x.before:testing test debug-before");
output.assertContains("DBUG:xxx:testing test debug-deprecated");
- output.assertNotContains("DBUG:xxx:testing test debug-depdeprecated-false");
+ output.assertContains("DBUG:x.after:testing test debug-after");
+ output.assertNotContains("DBUG:x.before:testing test debug-before-false");
+ output.assertNotContains("DBUG:xxx:testing test debug-deprecated-false");
+ output.assertNotContains("DBUG:x.after:testing test debug-after-false");
}
@Test

Back to the top