Skip to content

Commit

Permalink
ongoing work on appender-ref within appender
Browse files Browse the repository at this point in the history
  • Loading branch information
ceki committed Feb 17, 2021
1 parent 1e62f44 commit 61ffd3a
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 deletions.
Expand Up @@ -4,15 +4,14 @@
<configuration debug="false">


<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<queueSize>256</queueSize>
<includeCallerData>false</includeCallerData>
<appender-ref ref="LIST" />
</appender>

<appender name="LIST" class="ch.qos.logback.core.read.ListAppender"/>


<appender name="LIST" class="ch.qos.logback.core.read.ListAppender"/>

<root level="debug">
<appender-ref ref="ASYNC" />
</root>
Expand Down
20 changes: 20 additions & 0 deletions logback-classic/src/test/input/joran/asyncAppender_list_first.xml
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration>

<configuration debug="false">

<appender name="LIST" class="ch.qos.logback.core.read.ListAppender"/>


<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<queueSize>256</queueSize>
<includeCallerData>false</includeCallerData>
<appender-ref ref="LIST" />
</appender>

<root level="debug">
<appender-ref ref="ASYNC" />
</root>


</configuration>
Expand Up @@ -497,17 +497,22 @@ public void unreferencedAppendersShouldBeSkipped() throws JoranException {


@Test
public void asynAppender() throws JoranException {
configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "asyncAppender.xml");
public void asynAppenderListFirst() throws JoranException {
configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "asyncAppender_list_first.xml");

final AsyncAppender asyncAppender = (AsyncAppender) root.getAppender("ASYNC");
assertNotNull(asyncAppender);
StatusPrinter.print(loggerContext);

assertNotNull(asyncAppender);
assertTrue(asyncAppender.isStarted());
StatusPrinter.print(loggerContext);
}

@Test
public void asynAppenderListAfter() throws JoranException {
configure(ClassicTestConstants.JORAN_INPUT_PREFIX + "asyncAppender_list_after.xml");

StatusChecker checker = new StatusChecker(loggerContext);
//checker.assertContainsMatch(Status.WARN, "Appender named \\[B\\] not referenced. Skipping further processing.");
final AsyncAppender asyncAppender = (AsyncAppender) root.getAppender("ASYNC");
StatusPrinter.print(loggerContext);
assertNotNull(asyncAppender);
assertTrue(asyncAppender.isStarted());
}
}

0 comments on commit 61ffd3a

Please sign in to comment.