379207 backported fixes from jetty-9 to make hierarchy work
This commit is contained in:
parent
748f06cad7
commit
c7c4c6e13b
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue