Table of Contents

Class AspNetTraceAppender

Namespace
log4net.Appender
Assembly
log4net.dll

Appends log events to the ASP.NET System.Web.TraceContext system.

public class AspNetTraceAppender : AppenderSkeleton, IBulkAppender, IAppender, IOptionHandler
Inheritance
AspNetTraceAppender
Implements
Inherited Members

Remarks

Diagnostic information and tracing messages that you specify are appended to the output of the page that is sent to the requesting browser. Optionally, you can view this information from a separate trace viewer (Trace.axd) that displays trace information for every page in a given application.

Trace statements are processed and displayed only when tracing is enabled. You can control whether tracing is displayed to a page, to the trace viewer, or both.

The logging event is passed to the TraceContext.Write(string) or TraceContext.Warn(string) method depending on the level of the logging event. The event's logger name is the default value for the category parameter of the Write/Warn method.

Constructors

AspNetTraceAppender()

Initializes a new instance of the AspNetTraceAppender class.

public AspNetTraceAppender()

Remarks

Default constructor.

Properties

Category

The category parameter sent to the Trace method.

public PatternLayout Category { get; set; }

Property Value

PatternLayout

Remarks

Defaults to %logger which will use the logger name of the current LoggingEvent as the category parameter.

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)

Write the logging event to the ASP.NET trace

protected override void Append(LoggingEvent loggingEvent)

Parameters

loggingEvent LoggingEvent

the event to log

Remarks

Write the logging event to the ASP.NET trace HttpContext.Current.Trace (System.Web.TraceContext).