Causes a flush on a wrapped target if LogEvent satisfies provided condition.
If condition isn't set, a flush will occur after each successful write.
Platforms Supported: All
<targets> <target xsi:type="AutoFlushWrapper" name="String" condition="Condition"> <target xsi:type="wrappedTargetType" ...target properties... /> </target> </targets>
name - Name of the target.
condition - Condition is expression used to determine if flush must be executed.
Introduced in NLog 4.4
asyncFlush - Delay the flush until the LogEvent has been confirmed as written. Default true
.
Introduced in NLog 4.4.6 where BufferingWrapper-target defaults to
false
, to avoid waiting long time (forever) to flush
NLog 4.7 implements same behavior for AsyncTaskTarget so it defaults to
false
, to reduce waiting time for flush.
flushOnConditionOnly - Ignores explicit flush operations caused by calling NLog.LogManager.Flush()
or NLog.LogManager.Shutdown()
. Useful when combined with BufferingWrapper and overflowAction=Discard
.
Introduced in NLog 4.6.6
Flush into target on each write
<?xml version="1.0" ?> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"> <targets> <target name="file" xsi:type="AutoFlushWrapper"> <target xsi:type="File" fileName="${basedir}/file.txt" /> </target> </targets> <rules> <logger name="*" minlevel="Debug" writeTo="file" /> </rules> </nlog>
Flush into target, if LogEvent level >= Warn (introduced in NLog 4.4)
<?xml version="1.0" ?> <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"> <targets> <target name="file" xsi:type="AutoFlushWrapper" condition="level >= LogLevel.Warn"> <target xsi:type="bufferingWrapper" overflowAction="Discard"> <target xsi:type="File" fileName="${basedir}/file.txt" /> </target> </target> </targets> <rules> <logger name="*" minlevel="Debug" writeTo="file" /> </rules> </nlog>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4