Skip to content

Commit

Permalink
Use <appender-ref> instead of nested appenders in XML configuration (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
brenuart committed Oct 11, 2022
1 parent 9833bd7 commit 914400c
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ in your `logback.xml`, like this:

<root level="all">
<appender-ref ref="stash" />
</root>
</root>
</configuration>
```
You can further customize the JSON output by customizing the layout as described in later sections.
Expand Down Expand Up @@ -684,13 +684,21 @@ These async appenders can delegate to any other underlying logback appender.
For example:

```xml
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
...
</appender>

<appender name="async" class="net.logstash.logback.appender.LoggingEventAsyncDisruptorAppender">
<appender class="ch.qos.logback.core.rolling.RollingFileAppender">
...
</appender>
<appender-ref ref="file" />
</appender>
```

> **WARNING**
> Since Logback 1.3 it is not allowed anymore to declare an `<appender>` inside another `<appender>`. The nested appender should instead be declared outside and `<appender-ref>` must be used to refer to it.
>
> See [LOGBACK-1674](https://jira.qos.ch/browse/LOGBACK-1674] for more information.

#### RingBuffer Size

Logging events are first enqueued in a ring buffer before they are delivered to their final destination by a separate handler thread.
Expand Down Expand Up @@ -745,9 +753,7 @@ The wait strategy can be configured on the async appender using the `waitStrateg
```xml
<appender name="async" class="net.logstash.logback.appender.LoggingEventAsyncDisruptorAppender">
<waitStrategyType>sleeping</waitStrategyType>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender">
...
</appender>
...
</appender>
```

Expand Down

0 comments on commit 914400c

Please sign in to comment.