提交 f1e44404 编写于 作者: K Kohsuke Kawaguchi

Revert "Merge branch 'pull-1091'"

This reverts commit 1fda95b6, reversing
changes made to 0fd39c44.

Daniel Beck confirmed that I wasn't supposed to merge both 1090 and
1091. After discussion with him, I'm taking 1090.

See: https://github.com/jenkinsci/jenkins/commit/1fda95b6aea55cb216074b18bbb34fd8708c64c0#commitcomment-5112285
上级 4335bd43
...@@ -40,7 +40,7 @@ THE SOFTWARE. ...@@ -40,7 +40,7 @@ THE SOFTWARE.
description="${%List of loggers and the log levels to record}" description="${%List of loggers and the log levels to record}"
help="/help/LogRecorder/logger.html"> help="/help/LogRecorder/logger.html">
<j:set var="instance" value="${null}" /> <j:set var="instance" value="${null}" />
<f:repeatable var="instance" items="${it.targets}" name="targets" header="Logger"> <f:repeatable var="instance" items="${it.targets}" name="targets">
<table width="100%"> <table width="100%">
<tr> <tr>
<th style="white-space:nowrap;"> <th style="white-space:nowrap;">
......
...@@ -57,36 +57,37 @@ public class LogRecorderTest { ...@@ -57,36 +57,37 @@ public class LogRecorderTest {
@Test public void testSpecificExclusion() { @Test public void testSpecificExclusion() {
LogRecorder lr = new LogRecorder("foo"); LogRecorder lr = new LogRecorder("foo");
LogRecorder.Target targetH = new LogRecorder.Target("foo.bar", Level.SEVERE); LogRecorder.Target targetLevel0 = new LogRecorder.Target("", Level.FINE);
LogRecorder.Target targetM = new LogRecorder.Target("foo", Level.INFO); LogRecorder.Target targetLevel1 = new LogRecorder.Target("foo", Level.INFO);
LogRecorder.Target targetL = new LogRecorder.Target("", Level.FINE); LogRecorder.Target targetLevel2 = new LogRecorder.Target("foo.bar", Level.SEVERE);
lr.targets.add(targetH); lr.targets.add(targetLevel1);
lr.targets.add(targetM); lr.targets.add(targetLevel2);
lr.targets.add(targetL); lr.targets.add(targetLevel0);
LogRecord r1h = createLogRecord("foo.bar.baz", Level.INFO, "hidden"); assertEquals(lr.orderedTargets()[0], targetLevel2);
LogRecord r1v = createLogRecord("foo.bar.baz", Level.SEVERE, "visible"); assertEquals(lr.orderedTargets()[1], targetLevel1);
LogRecord r2h = createLogRecord("foo.bar", Level.INFO, "hidden"); assertEquals(lr.orderedTargets()[2], targetLevel0);
LogRecord r2v = createLogRecord("foo.bar", Level.SEVERE, "hidden");
LogRecord r3h = createLogRecord("foo", Level.FINE, "hidden"); LogRecord r1 = createLogRecord("baz", Level.INFO, "visible");
LogRecord r3v = createLogRecord("foo", Level.INFO, "visible"); LogRecord r2 = createLogRecord("foo", Level.FINE, "hidden");
LogRecord r4v = createLogRecord("baz", Level.INFO, "visible"); LogRecord r3 = createLogRecord("foo.bar", Level.INFO, "hidden");
lr.handler.publish(r1h); LogRecord r4 = createLogRecord("foo.bar.baz", Level.INFO, "hidden");
lr.handler.publish(r1v); LogRecord r5 = createLogRecord("foo.bar.baz", Level.SEVERE, "visible");
lr.handler.publish(r2h); LogRecord r6 = createLogRecord("foo", Level.INFO, "visible");
lr.handler.publish(r2v); lr.handler.publish(r1);
lr.handler.publish(r3v); lr.handler.publish(r2);
lr.handler.publish(r3h); lr.handler.publish(r3);
lr.handler.publish(r4v); lr.handler.publish(r4);
lr.handler.publish(r5);
assertTrue(lr.handler.getView().contains(r1v)); lr.handler.publish(r6);
assertFalse(lr.handler.getView().contains(r1h));
assertFalse(lr.handler.getView().contains(r2h)); assertTrue(lr.handler.getView().contains(r1));
assertTrue(lr.handler.getView().contains(r2v)); assertFalse(lr.handler.getView().contains(r2));
assertFalse(lr.handler.getView().contains(r3h)); assertFalse(lr.handler.getView().contains(r3));
assertTrue(lr.handler.getView().contains(r3v)); assertFalse(lr.handler.getView().contains(r4));
assertTrue(lr.handler.getView().contains(r4v)); assertTrue(lr.handler.getView().contains(r5));
assertTrue(lr.handler.getView().contains(r6));
} }
private static LogRecord createLogRecord(String logger, Level level, String message) { private static LogRecord createLogRecord(String logger, Level level, String message) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册