@@ -3620,8 +3620,11 @@ <h3><a name="WriteYourOwnAppender"
36203620 < p > The < code > CountingConsoleAppender</ code > , which we list next,
36213621 appends a limited number of incoming events on the console. It
36223622 shuts down after the limit is reached. It uses a
3623- < code > Layout</ code > to format the events and accepts a parameter.
3624- Thus, a few more methods are needed.
3623+ < code > PatternLayoutEncoder</ code > to format the events and accepts
3624+ a parameter named < code > limit</ code > . Therefore, a few more
3625+ methods beyond < code > append(Object eventObject)</ code > are
3626+ needed. As shown below, these parameters are handles
3627+ auto-magically by logback's various configuration mechanisms.
36253628 </ p >
36263629
36273630 < em > Example 4.< span class ="autoExec "/> :
@@ -3654,7 +3657,7 @@ <h3><a name="WriteYourOwnAppender"
36543657 @Override
36553658 public void start() {
36563659 if (this.encoder == null) {
3657- addError("No layout set for the appender named ["+ name +"].");
3660+ addError("No encoder set for the appender named ["+ name +"].");
36583661 return;
36593662 }
36603663
@@ -3686,24 +3689,23 @@ <h3><a name="WriteYourOwnAppender"
36863689 public void setEncoder(PatternLayoutEncoder encoder) {
36873690 this.encoder = encoder;
36883691 }
3689-
3690-
36913692}</ pre >
36923693
36933694 < p > The < code > start()</ code > method checks for the presence of a
3694- < code > Layout </ code > . In case the layout is not set, the appender
3695- fails to start with an error message.
3695+ < code > PatternLayoutEncoder </ code > . In case the encoder is not
3696+ set, the appender fails to start and emits an error message.
36963697 </ p >
36973698
36983699 < p > This custom appender illustrates two points:</ p >
36993700
37003701 < ul >
37013702
37023703 < li > All properties that follow the setter/getter JavaBeans
3703- conventions are handled transparently. The < code > start()</ code >
3704- method, which is called automatically during logback
3705- configuration, has the responsibility of verifying that the
3706- various properties of the appender are coherent.
3704+ conventions are handled transparently by logback
3705+ configurators. The < code > start()</ code > method, which is called
3706+ automatically during logback configuration, has the
3707+ responsibility of verifying that the various properties of the
3708+ appender are set and are coherent.
37073709 </ li >
37083710
37093711 < li > The < code > AppenderBase.doAppend()</ code > method invokes the
0 commit comments