|
| 1 | +//// |
| 2 | + Licensed to the Apache Software Foundation (ASF) under one or more |
| 3 | + contributor license agreements. See the NOTICE file distributed with |
| 4 | + this work for additional information regarding copyright ownership. |
| 5 | + The ASF licenses this file to You under the Apache License, Version 2.0 |
| 6 | + (the "License"); you may not use this file except in compliance with |
| 7 | + the License. You may obtain a copy of the License at |
| 8 | + |
| 9 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + |
| 11 | + Unless required by applicable law or agreed to in writing, software |
| 12 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + See the License for the specific language governing permissions and |
| 15 | + limitations under the License. |
| 16 | +//// |
| 17 | +
|
| 18 | +[#bufferingforwardingappender] |
| 19 | += BufferingForwardingAppender |
| 20 | +
|
| 21 | +The following example shows how to configure the BufferingForwardingAppender to buffer 100 messages before delivering them to the ConsoleAppender. |
| 22 | +
|
| 23 | +[source,xml] |
| 24 | +---- |
| 25 | +<appender name="BufferingForwardingAppender" type="log4net.Appender.BufferingForwardingAppender" > |
| 26 | + <bufferSize value="100"/> |
| 27 | + <!-- |
| 28 | + The value configures what gets fixed immediately when calling logger.Log(). |
| 29 | + The default value is All, which may negatively impact performance enough to warrant changing it to fix less data. |
| 30 | + More information can be found at https://github.com/apache/logging-log4net/blob/master/src/log4net/Core/FixFlags.cs |
| 31 | + --> |
| 32 | + <fix value="All"/> |
| 33 | + <appender-ref ref="ConsoleAppender" /> |
| 34 | +</appender> |
| 35 | +---- |
| 36 | +
|
| 37 | +This example shows how to deliver only significant events. |
| 38 | +
|
| 39 | +A LevelEvaluator is specified with a threshold of WARN. |
| 40 | +This means that the events will only be delivered when a message with level of WARN or higher level is logged. |
| 41 | +
|
| 42 | +Up to 512 (BufferSize) previous messages of any level will also be delivered to provide context information. |
| 43 | +Messages not sent will be discarded. |
| 44 | +
|
| 45 | +[source,xml] |
| 46 | +---- |
| 47 | +<appender name="BufferingForwardingAppender" type="log4net.Appender.BufferingForwardingAppender" > |
| 48 | + <bufferSize value="512" /> |
| 49 | + <lossy value="true" /> |
| 50 | + <evaluator type="log4net.Core.LevelEvaluator"> |
| 51 | + <threshold value="WARN"/> |
| 52 | + </evaluator> |
| 53 | + <appender-ref ref="ConsoleAppender" /> |
| 54 | +</appender> |
| 55 | +---- |
0 commit comments