Class DebugAppender
Appends log events to the Debug system.
public class DebugAppender : AppenderSkeleton, IBulkAppender, IAppender, IOptionHandler
- Inheritance
-
DebugAppender
- Implements
- Inherited Members
Remarks
The application configuration file can be used to control what listeners are actually used. See the MSDN documentation for the Debug class for details on configuring the debug system.
Events are written using the System.Diagnostics.Debug.Write(string,string) method. The event's logger name is passed as the value for the category name to the Write method.
Constructors
DebugAppender()
Initializes a new instance of the DebugAppender.
public DebugAppender()
Remarks
Default constructor.
DebugAppender(ILayout)
Initializes a new instance of the DebugAppender with a specified layout.
[Obsolete("Instead use the default constructor and set the Layout property")]
public DebugAppender(ILayout layout)
Parameters
layoutILayoutThe layout to use with this appender.
Remarks
Obsolete constructor.
Properties
ImmediateFlush
Gets or sets a value that indicates whether the appender will flush at the end of each write.
public bool ImmediateFlush { get; set; }
Property Value
Remarks
The default behavior is to flush at the end of each
write. If the option is set tofalse, then the underlying
stream can defer writing to physical medium to a later time.
Avoiding the flush operation at the end of each append results in a performance gain of 10 to 20 percent. However, there is safety trade-off involved in skipping flushing. Indeed, when flushing is skipped, then it is likely that the last few log events will not be recorded on disk when the application exits. This is a high price to pay even for a 20% performance gain.
RequiresLayout
This appender requires a log4net.Layout to be set.
protected override bool RequiresLayout { get; }
Property Value
- bool
true
Remarks
This appender requires a log4net.Layout to be set.
Methods
Append(LoggingEvent)
Writes the logging event to the Debug system.
protected override void Append(LoggingEvent loggingEvent)
Parameters
loggingEventLoggingEventThe event to log.
Remarks
Writes the logging event to the Debug system.
If ImmediateFlush is true then the Flush()
is called.