Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use <appender-ref> instead of nested appenders in XML configuration #875

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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