AsyncWrapper target
If you want to contribute, please create a user account and contact Jarek to get edit access.
Provides asynchronous, buffered execution of target writes.
Supported in



Configuration Syntax
<targets>
<target xsi:type="AsyncWrapper"
name="String"
queueLimit="Integer"
timeToSleepBetweenBatches="Integer"
batchSize="Integer"
overflowAction="Enum">
<target xsi:type="wrappedTargetType" ...target properties... />
</target>
</targets>
Read more about using the Configuration File.<target xsi:type="AsyncWrapper"
name="String"
queueLimit="Integer"
timeToSleepBetweenBatches="Integer"
batchSize="Integer"
overflowAction="Enum">
<target xsi:type="wrappedTargetType" ...target properties... />
</target>
</targets>
Parameters
- General Options
- name - Name of the target.
- Buffering Options
- queueLimit - Limit on the number of requests in the lazy writer thread request queue.Integer Default: 10000
- timeToSleepBetweenBatches - Time in milliseconds to sleep between batches.Integer Default: 50
- batchSize - Number of log events that should be processed in a batch by the lazy writer thread.Integer Default: 100
- overflowAction - Action to be taken when the lazy writer thread request queue count exceeds the set limit. Default: Discard
Possible values:
Remarks
Asynchronous target wrapper allows the logger code to execute more quickly, by queueing messages and processing them in a separate thread. You should wrap targets that spend a non-trivial amount of time in their Write() method with asynchronous target to speed up logging. Because asynchronous logging is quite a common scenario, NLog supports a shorthand notation for wrapping all targets with AsyncWrapper. Just add async="true" to the <targets/> element in the configuration file. <targets async="true"> ... your targets go here ... </targets>




