log4net
Appender that logs to a database.
appends logging events to a table within a
database. The appender can be configured to specify the connection
string by setting the property.
The connection type (provider) can be specified by setting the
property. For more information on database connection strings for
your specific database see http://www.connectionstrings.com/.
Records are written into the database either using a prepared
statement or a stored procedure. The property
is set to (System.Data.CommandType.Text) to specify a prepared statement
or to (System.Data.CommandType.StoredProcedure) to specify a stored
procedure.
The prepared statement text or the name of the stored procedure
must be set in the property.
The prepared statement or stored procedure can take a number
of parameters. Parameters are added using the
method. This adds a single to the
ordered list of parameters. The
type may be subclassed if required to provide database specific
functionality. The specifies
the parameter name, database type, size, and how the value should
be generated using a .
An example of a SQL Server table that could be logged to:
CREATE TABLE [dbo].[Log] (
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[Date] [datetime] NOT NULL ,
[Thread] [varchar] (255) NOT NULL ,
[Level] [varchar] (20) NOT NULL ,
[Logger] [varchar] (255) NOT NULL ,
[Message] [varchar] (4000) NOT NULL
) ON [PRIMARY]
An example configuration to log to the above table:
Julian Biddle
Nicko Cadell
Gert Driesen
Lance Nehring
Abstract base class implementation of that
buffers events in a fixed size buffer.
This base class should be used by appenders that need to buffer a
number of events before logging them. For example the
buffers events and then submits the entire contents of the buffer to
the underlying database in one go.
Subclasses should override the
method to deliver the buffered events.
The BufferingAppenderSkeleton maintains a fixed size cyclic
buffer of events. The size of the buffer is set using
the property.
A is used to inspect
each event as it arrives in the appender. If the
triggers, then the current buffer is sent immediately
(see ). Otherwise the event
is stored in the buffer. For example, an evaluator can be used to
deliver the events immediately when an ERROR event arrives.
The buffering appender can be configured in a mode.
By default the appender is NOT lossy. When the buffer is full all
the buffered events are sent with .
If the property is set to true then the
buffer will not be sent when it is full, and new events arriving
in the appender will overwrite the oldest event in the buffer.
In lossy mode the buffer will only be sent when the
triggers. This can be useful behavior when you need to know about
ERROR events but not about events with a lower level, configure an
evaluator that will trigger when an ERROR event arrives, the whole
buffer will be sent which gives a history of events leading up to
the ERROR event.
Nicko Cadell
Gert Driesen
Abstract base class implementation of .
This class provides the code for common functionality, such
as support for threshold filtering and support for general filters.
Appenders can also implement the interface. Therefore
they would require that the method
be called after the appenders properties have been configured.
Nicko Cadell
Gert Driesen
Implement this interface for your own strategies for printing log statements.
Implementors should consider extending the
class which provides a default implementation of this interface.
Appenders can also implement the interface. Therefore
they would require that the method
be called after the appenders properties have been configured.
Nicko Cadell
Gert Driesen
Closes the appender and releases resources.
Releases any resources allocated within the appender such as file handles,
network connections, etc.
It is a programming error to append to a closed appender.
Log the logging event in Appender specific way.
The event to log
This method is called to log a message into this appender.
Gets or sets the name of this appender.
The name of the appender.
The name uniquely identifies the appender.
Interface for appenders that support bulk logging.
This interface extends the interface to
support bulk logging of objects. Appenders
should only implement this interface if they can bulk log efficiently.
Nicko Cadell
Log the array of logging events in Appender specific way.
The events to log
This method is called to log an array of events into this appender.
Interface used to delay activate a configured object.
This allows an object to defer activation of its options until all
options have been set. This is required for components which have
related options that remain ambiguous until all are set.
If a component implements this interface then the method
must be called by the container after its all the configured properties have been set
and before the component can be used.
Nicko Cadell
Activate the options that were previously set with calls to properties.
This allows an object to defer activation of its options until all
options have been set. This is required for components which have
related options that remain ambiguous until all are set.
If a component implements this interface then this method must be called
after its properties have been set before the component can be used.
Initial buffer size
Maximum buffer size before it is recycled
Default constructor
Empty default constructor
Finalizes this appender by calling the implementation's
method.
If this appender has not been closed then the Finalize method
will call .
Initialize the appender based on the options set
This is part of the delayed object
activation scheme. The method must
be called on this object after the configuration properties have
been set. Until is called this
object is in an undefined state and must not be used.
If any of the configuration properties are modified then
must be called again.
Closes the appender and release resources.
Release any resources allocated within the appender such as file handles,
network connections, etc.
It is a programming error to append to a closed appender.
This method cannot be overridden by subclasses. This method
delegates the closing of the appender to the
method which must be overridden in the subclass.
Performs threshold checks and invokes filters before
delegating actual logging to the subclasses specific
method.
The event to log.
This method cannot be overridden by derived classes. A
derived class should override the method
which is called by this method.
The implementation of this method is as follows:
-
Checks that the severity of the
is greater than or equal to the of this
appender.
-
Checks that the chain accepts the
.
-
Calls and checks that
it returns true.
If all of the above steps succeed then the
will be passed to the abstract method.
Performs threshold checks and invokes filters before
delegating actual logging to the subclasses specific
method.
The array of events to log.
This method cannot be overridden by derived classes. A
derived class should override the method
which is called by this method.
The implementation of this method is as follows:
-
Checks that the severity of the
is greater than or equal to the of this
appender.
-
Checks that the chain accepts the
.
-
Calls and checks that
it returns true.
If all of the above steps succeed then the
will be passed to the method.
Test if the logging event should we output by this appender
the event to test
true if the event should be output, false if the event should be ignored
This method checks the logging event against the threshold level set
on this appender and also against the filters specified on this
appender.
The implementation of this method is as follows:
-
Checks that the severity of the
is greater than or equal to the of this
appender.
-
Checks that the chain accepts the
.
Adds a filter to the end of the filter chain.
the filter to add to this appender
The Filters are organized in a linked list.
Setting this property causes the new filter to be pushed onto the
back of the filter chain.
Clears the filter list for this appender.
Clears the filter list for this appender.
Checks if the message level is below this appender's threshold.
to test against.
If there is no threshold set, then the return value is always true.
true if the meets the
requirements of this appender.
Is called when the appender is closed. Derived classes should override
this method if resources need to be released.
Releases any resources allocated within the appender such as file handles,
network connections, etc.
It is a programming error to append to a closed appender.
Subclasses of should implement this method
to perform actual logging.
The event to append.
A subclass must implement this method to perform
logging of the .
This method will be called by
if all the conditions listed for that method are met.
To restrict the logging of events in the appender
override the method.
Append a bulk array of logging events.
the array of logging events
This base class implementation calls the
method for each element in the bulk array.
A sub class that can better process a bulk array of events should
override this method in addition to .
Called before as a precondition.
This method is called by
before the call to the abstract method.
This method can be overridden in a subclass to extend the checks
made before the event is passed to the method.
A subclass should ensure that they delegate this call to
this base class if it is overridden.
true if the call to should proceed.
Renders the to a string.
The event to render.
The event rendered as a string.
Helper method to render a to
a string. This appender must have a
set to render the to
a string.
If there is exception data in the logging event and
the layout does not process the exception, this method
will append the exception text to the rendered string.
Where possible use the alternative version of this method
.
That method streams the rendering onto an existing Writer
which can give better performance if the caller already has
a open and ready for writing.
Renders the to a string.
The event to render.
The TextWriter to write the formatted event to
Helper method to render a to
a string. This appender must have a
set to render the to
a string.
If there is exception data in the logging event and
the layout does not process the exception, this method
will append the exception text to the rendered string.
Use this method in preference to
where possible. If, however, the caller needs to render the event
to a string then does
provide an efficient mechanism for doing so.
The layout of this appender.
See for more information.
The name of this appender.
See for more information.
The level threshold of this appender.
There is no level threshold filtering by default.
See for more information.
It is assumed and enforced that errorHandler is never null.
It is assumed and enforced that errorHandler is never null.
See for more information.
The first filter in the filter chain.
Set to null initially.
See for more information.
The last filter in the filter chain.
See for more information.
Flag indicating if this appender is closed.
See for more information.
The guard prevents an appender from repeatedly calling its own DoAppend method
StringWriter used to render events
Gets or sets the threshold of this appender.
The threshold of the appender.
All log events with lower level than the threshold level are ignored
by the appender.
In configuration files this option is specified by setting the
value of the option to a level
string, such as "DEBUG", "INFO" and so on.
Gets or sets the for this appender.
The of the appender
The provides a default
implementation for the property.
The filter chain.
The head of the filter chain filter chain.
Returns the head Filter. The Filters are organized in a linked list
and so all Filters on this Appender are available through the result.
Gets or sets the for this appender.
The layout of the appender.
See for more information.
Gets or sets the name of this appender.
The name of the appender.
The name uniquely identifies the appender.
Tests if this appender requires a to be set.
In the rather exceptional case, where the appender
implementation admits a layout but can also work without it,
then the appender should return true.
This default implementation always returns true.
true if the appender requires a layout object, otherwise false.
The default buffer size.
The default size of the cyclic buffer used to store events.
This is set to 512 by default.
Initializes a new instance of the class.
Protected default constructor to allow subclassing.
Initializes a new instance of the class.
the events passed through this appender must be
fixed by the time that they arrive in the derived class' SendBuffer method.
Protected constructor to allow subclassing.
The should be set if the subclass
expects the events delivered to be fixed even if the
is set to zero, i.e. when no buffering occurs.
Flush the currently buffered events
Flushes any events that have been buffered.
If the appender is buffering in mode then the contents
of the buffer will NOT be flushed to the appender.
Flush the currently buffered events
set to true to flush the buffer of lossy events
Flushes events that have been buffered. If is
false then events will only be flushed if this buffer is non-lossy mode.
If the appender is buffering in mode then the contents
of the buffer will only be flushed if is true.
In this case the contents of the buffer will be tested against the
and if triggering will be output. All other buffered
events will be discarded.
If is true then the buffer will always
be emptied by calling this method.
Initialize the appender based on the options set
This is part of the delayed object
activation scheme. The method must
be called on this object after the configuration properties have
been set. Until is called this
object is in an undefined state and must not be used.
If any of the configuration properties are modified then
must be called again.
Close this appender instance.
Close this appender instance. If this appender is marked
as not then the remaining events in
the buffer must be sent when the appender is closed.
This method is called by the method.
the event to log
Stores the in the cyclic buffer.
The buffer will be sent (i.e. passed to the
method) if one of the following conditions is met:
-
The cyclic buffer is full and this appender is
marked as not lossy (see )
-
An is set and
it is triggered for the
specified.
Before the event is stored in the buffer it is fixed
(see ) to ensure that
any data referenced by the event will be valid when the buffer
is processed.
Sends the contents of the buffer.
The first logging event.
The buffer containing the events that need to be send.
The subclass must override .
Sends the events.
The events that need to be send.
The subclass must override this method to process the buffered events.
The size of the cyclic buffer used to hold the logging events.
Set to by default.
The cyclic buffer used to store the logging events.
The triggering event evaluator that causes the buffer to be sent immediately.
The object that is used to determine if an event causes the entire
buffer to be sent immediately. This field can be null, which
indicates that event triggering is not to be done. The evaluator
can be set using the property. If this appender
has the ( property) set to
true then an must be set.
Indicates if the appender should overwrite events in the cyclic buffer
when it becomes full, or if the buffer should be flushed when the
buffer is full.
If this field is set to true then an must
be set.
The triggering event evaluator filters discarded events.
The object that is used to determine if an event that is discarded should
really be discarded or if it should be sent to the appenders.
This field can be null, which indicates that all discarded events will
be discarded.
Value indicating which fields in the event should be fixed
By default all fields are fixed
The events delivered to the subclass must be fixed.
Gets or sets a value that indicates whether the appender is lossy.
true if the appender is lossy, otherwise false. The default is false.
This appender uses a buffer to store logging events before
delivering them. A triggering event causes the whole buffer
to be send to the remote sink. If the buffer overruns before
a triggering event then logging events could be lost. Set
to false to prevent logging events
from being lost.
If is set to true then an
must be specified.
Gets or sets the size of the cyclic buffer used to hold the
logging events.
The size of the cyclic buffer used to hold the logging events.
The option takes a positive integer
representing the maximum number of logging events to collect in
a cyclic buffer. When the is reached,
oldest events are deleted as new events are added to the
buffer. By default the size of the cyclic buffer is 512 events.
If the is set to a value less than
or equal to 1 then no buffering will occur. The logging event
will be delivered synchronously (depending on the
and properties). Otherwise the event will
be buffered.
Gets or sets the that causes the
buffer to be sent immediately.
The that causes the buffer to be
sent immediately.
The evaluator will be called for each event that is appended to this
appender. If the evaluator triggers then the current buffer will
immediately be sent (see ).
If is set to true then an
must be specified.
Gets or sets the value of the to use.
The value of the to use.
The evaluator will be called for each event that is discarded from this
appender. If the evaluator triggers then the current buffer will immediately
be sent (see ).
Gets or sets a value indicating if only part of the logging event data
should be fixed.
true if the appender should only fix part of the logging event
data, otherwise false. The default is false.
Setting this property to true will cause only part of the
event data to be fixed and serialized. This will improve performance.
See for more information.
Gets or sets a the fields that will be fixed in the event
The event fields that will be fixed before the event is buffered
The logging event needs to have certain thread specific values
captured before it can be buffered. See
for details.
Initializes a new instance of the class.
Public default constructor to initialize a new instance of this class.
Initialize the appender based on the options set
This is part of the delayed object
activation scheme. The method must
be called on this object after the configuration properties have
been set. Until is called this
object is in an undefined state and must not be used.
If any of the configuration properties are modified then
must be called again.
Override the parent method to close the database
Closes the database command and database connection.
Inserts the events into the database.
The events to insert into the database.
Insert all the events specified in the
array into the database.
Adds a parameter to the command.
The parameter to add to the command.
Adds a parameter to the ordered list of command parameters.
Writes the events to the database using the transaction specified.
The transaction that the events will be executed under.
The array of events to insert into the database.
The transaction argument can be null if the appender has been
configured not to use transactions. See
property for more information.
Formats the log message into database statement text.
The event being logged.
This method can be overridden by subclasses to provide
more control over the format of the database statement.
Text that can be passed to a .
Connects to the database.
Retrieves the class type of the ADO.NET provider.
Gets the Type of the ADO.NET provider to use to connect to the
database. This method resolves the type specified in the
property.
Subclasses can override this method to return a different type
if necessary.
The of the ADO.NET provider
Prepares the database command and initialize the parameters.
Flag to indicate if we are using a command object
Set to true when the appender is to use a prepared
statement or stored procedure to insert into the database.
The list of objects.
The list of objects.
The security context to use for privileged calls
The that will be used
to insert logging events into a database.
The database command.
Database connection string.
String type name of the type name.
The text of the command.
The command type.
Indicates whether to use transactions when writing to the database.
Indicates whether to use transactions when writing to the database.
Gets or sets the database connection string that is used to connect to
the database.
The database connection string used to connect to the database.
The connections string is specific to the connection type.
See for more information.
Connection string for MS Access via ODBC:
"DSN=MS Access Database;UID=admin;PWD=;SystemDB=C:\data\System.mdw;SafeTransactions = 0;FIL=MS Access;DriverID = 25;DBQ=C:\data\train33.mdb"
Another connection string for MS Access via ODBC:
"Driver={Microsoft Access Driver (*.mdb)};DBQ=C:\Work\cvs_root\log4net-1.2\access.mdb;UID=;PWD=;"
Connection string for MS Access via OLE DB:
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\cvs_root\log4net-1.2\access.mdb;User Id=;Password=;"
Gets or sets the type name of the connection
that should be created.
The type name of the connection.
The type name of the ADO.NET provider to use.
The default is to use the OLE DB provider.
Use the OLE DB Provider. This is the default value.
System.Data.OleDb.OleDbConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Use the MS SQL Server Provider.
System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Use the ODBC Provider.
Microsoft.Data.Odbc.OdbcConnection,Microsoft.Data.Odbc,version=1.0.3300.0,publicKeyToken=b77a5c561934e089,culture=neutral
This is an optional package that you can download from
http://msdn.microsoft.com/downloads
search for ODBC .NET Data Provider.
Use the Oracle Provider.
System.Data.OracleClient.OracleConnection, System.Data.OracleClient, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
This is an optional package that you can download from
http://msdn.microsoft.com/downloads
search for .NET Managed Provider for Oracle.
Gets or sets the command text that is used to insert logging events
into the database.
The command text used to insert logging events into the database.
Either the text of the prepared statement or the
name of the stored procedure to execute to write into
the database.
The property determines if
this text is a prepared statement or a stored procedure.
Gets or sets the command type to execute.
The command type to execute.
This value may be either (System.Data.CommandType.Text) to specify
that the is a prepared statement to execute,
or (System.Data.CommandType.StoredProcedure) to specify that the
property is the name of a stored procedure
to execute.
The default value is (System.Data.CommandType.Text).
Should transactions be used to insert logging events in the database.
true if transactions should be used to insert logging events in
the database, otherwise false. The default value is true.
Gets or sets a value that indicates whether transactions should be used
to insert logging events in the database.
When set a single transaction will be used to insert the buffered events
into the database. Otherwise each event will be inserted without using
an explicit transaction.
Gets or sets the used to call the NetSend method.
The used to call the NetSend method.
Unless a specified here for this appender
the is queried for the
security context to use. The default behavior is to use the security context
of the current thread.
Should this appender try to reconnect to the database on error.
true if the appender should try to reconnect to the database after an
error has occurred, otherwise false. The default value is false,
i.e. not to try to reconnect.
The default behaviour is for the appender not to try to reconnect to the
database if an error occurs. Subsequent logging events are discarded.
To force the appender to attempt to reconnect to the database set this
property to true.
When the appender attempts to connect to the database there may be a
delay of up to the connection timeout specified in the connection string.
This delay will block the calling application's thread.
Until the connection can be reestablished this potential delay may occur multiple times.
Gets or sets the underlying .
The underlying .
creates a to insert
logging events into a database. Classes deriving from
can use this property to get or set this . Use the
underlying returned from if
you require access beyond that which provides.
Parameter type used by the .
This class provides the basic database parameter properties
as defined by the interface.
This type can be subclassed to provide database specific
functionality. The two methods that are called externally are
and .
Initializes a new instance of the class.
Default constructor for the AdoNetAppenderParameter class.
Prepare the specified database command object.
The command to prepare.
Prepares the database command object by adding
this parameter to its collection of parameters.
Renders the logging event and set the parameter value in the command.
The command containing the parameter.
The event to be rendered.
Renders the logging event using this parameters layout
object. Sets the value of the parameter on the command object.
The name of this parameter.
The database type for this parameter.
Flag to infer type rather than use the DbType
The precision for this parameter.
The scale for this parameter.
The size for this parameter.
The to use to render the
logging event into an object for this parameter.
Gets or sets the name of this parameter.
The name of this parameter.
The name of this parameter. The parameter name
must match up to a named parameter to the SQL stored procedure
or prepared statement.
Gets or sets the database type for this parameter.
The database type for this parameter.
The database type for this parameter. This property should
be set to the database type from the
enumeration. See .
This property is optional. If not specified the ADO.NET provider
will attempt to infer the type from the value.
Gets or sets the precision for this parameter.
The precision for this parameter.
The maximum number of digits used to represent the Value.
This property is optional. If not specified the ADO.NET provider
will attempt to infer the precision from the value.
Gets or sets the scale for this parameter.
The scale for this parameter.
The number of decimal places to which Value is resolved.
This property is optional. If not specified the ADO.NET provider
will attempt to infer the scale from the value.
Gets or sets the size for this parameter.
The size for this parameter.
The maximum size, in bytes, of the data within the column.
This property is optional. If not specified the ADO.NET provider
will attempt to infer the size from the value.
Gets or sets the to use to
render the logging event into an object for this
parameter.
The used to render the
logging event into an object for this parameter.
The that renders the value for this
parameter.
The can be used to adapt
any into a
for use in the property.
Appends logging events to the terminal using ANSI color escape sequences.
AnsiColorTerminalAppender appends log events to the standard output stream
or the error output stream using a layout specified by the
user. It also allows the color of a specific level of message to be set.
This appender expects the terminal to understand the VT100 control set
in order to interpret the color codes. If the terminal or console does not
understand the control codes the behavior is not defined.
By default, all output is written to the console's standard output stream.
The property can be set to direct the output to the
error stream.
NOTE: This appender writes each message to the System.Console.Out or
System.Console.Error that is set at the time the event is appended.
Therefore it is possible to programmatically redirect the output of this appender
(for example NUnit does this to capture program output). While this is the desired
behavior of this appender it may have security implications in your application.
When configuring the ANSI colored terminal appender, a mapping should be
specified to map a logging level to a color. For example:
The Level is the standard log4net logging level and ForeColor and BackColor can be any
of the following values:
- Blue
- Green
- Red
- White
- Yellow
- Purple
- Cyan
These color values cannot be combined together to make new colors.
The attributes can be any combination of the following:
- Brightforeground is brighter
- Dimforeground is dimmer
- Underscoremessage is underlined
- Blinkforeground is blinking (does not work on all terminals)
- Reverseforeground and background are reversed
- Hiddenoutput is hidden
- Strikethroughmessage has a line through it
While any of these attributes may be combined together not all combinations
work well together, for example setting both Bright and Dim attributes makes
no sense.
Patrick Wagstrom
Nicko Cadell
The to use when writing to the Console
standard output stream.
The to use when writing to the Console
standard output stream.
The to use when writing to the Console
standard error output stream.
The to use when writing to the Console
standard error output stream.
Ansi code to reset terminal
Initializes a new instance of the class.
The instance of the class is set up to write
to the standard output stream.
Add a mapping of level to color
The mapping to add
Add a mapping to this appender.
Each mapping defines the foreground and background colours
for a level.
This method is called by the method.
The event to log.
Writes the event to the console.
The format of the output will depend on the appender's layout.
Initialize the options for this appender
Initialize the level to color mappings set on this appender.
Flag to write output to the error stream rather than the standard output stream
Mapping from level object to color value
Target is the value of the console output stream.
Target is the value of the console output stream.
This is either "Console.Out" or "Console.Error".
Target is the value of the console output stream.
This is either "Console.Out" or "Console.Error".
This appender requires a to be set.
true
This appender requires a to be set.
The enum of possible display attributes
The following flags can be combined together to
form the ANSI color attributes.
text is bright
text is dim
text is underlined
text is blinking
Not all terminals support this attribute
text and background colors are reversed
text is hidden
text is displayed with a strikethrough
The enum of possible foreground or background color values for
use with the color mapping method
The output can be in one for the following ANSI colors.
color is black
color is red
color is green
color is yellow
color is blue
color is magenta
color is cyan
color is white
A class to act as a mapping between the level that a logging call is made at and
the color it should be displayed as.
Defines the mapping between a level and the color it should be displayed in.
An entry in the
This is an abstract base class for types that are stored in the
object.
Nicko Cadell
Default protected constructor
Default protected constructor
Initialize any options defined on this entry
Should be overridden by any classes that need to initialise based on their options
The level that is the key for this mapping
The that is the key for this mapping
Get or set the that is the key for this
mapping subclass.
Initialize the options for the object
Combine the and together
and append the attributes.
The mapped foreground color for the specified level
Required property.
The mapped foreground color for the specified level
The mapped background color for the specified level
Required property.
The mapped background color for the specified level
The color attributes for the specified level
Required property.
The color attributes for the specified level
The combined , and
suitable for setting the ansi terminal color.
A strongly-typed collection of objects.
Nicko Cadell
Creates a read-only wrapper for a AppenderCollection instance.
list to create a readonly wrapper arround
An AppenderCollection wrapper that is read-only.
An empty readonly static AppenderCollection
Initializes a new instance of the AppenderCollection class
that is empty and has the default initial capacity.
Initializes a new instance of the AppenderCollection class
that has the specified initial capacity.
The number of elements that the new AppenderCollection is initially capable of storing.
Initializes a new instance of the AppenderCollection class
that contains elements copied from the specified AppenderCollection.
The AppenderCollection whose elements are copied to the new collection.
Initializes a new instance of the AppenderCollection class
that contains elements copied from the specified array.
The array whose elements are copied to the new list.
Initializes a new instance of the AppenderCollection class
that contains elements copied from the specified collection.
The collection whose elements are copied to the new list.
Allow subclasses to avoid our default constructors
Copies the entire AppenderCollection to a one-dimensional
array.
The one-dimensional array to copy to.
Copies the entire AppenderCollection to a one-dimensional
array, starting at the specified index of the target array.
The one-dimensional array to copy to.
The zero-based index in at which copying begins.
Adds a to the end of the AppenderCollection.
The to be added to the end of the AppenderCollection.
The index at which the value has been added.
Removes all elements from the AppenderCollection.
Creates a shallow copy of the .
A new with a shallow copy of the collection data.
Determines whether a given is in the AppenderCollection.
The to check for.
true if is found in the AppenderCollection; otherwise, false.
Returns the zero-based index of the first occurrence of a
in the AppenderCollection.
The to locate in the AppenderCollection.
The zero-based index of the first occurrence of
in the entire AppenderCollection, if found; otherwise, -1.
Inserts an element into the AppenderCollection at the specified index.
The zero-based index at which should be inserted.
The to insert.
is less than zero
-or-
is equal to or greater than .
Removes the first occurrence of a specific from the AppenderCollection.
The to remove from the AppenderCollection.
The specified was not found in the AppenderCollection.
Removes the element at the specified index of the AppenderCollection.
The zero-based index of the element to remove.
is less than zero
-or-
is equal to or greater than .
Returns an enumerator that can iterate through the AppenderCollection.
An for the entire AppenderCollection.
Adds the elements of another AppenderCollection to the current AppenderCollection.
The AppenderCollection whose elements should be added to the end of the current AppenderCollection.
The new of the AppenderCollection.
Adds the elements of a array to the current AppenderCollection.
The array whose elements should be added to the end of the AppenderCollection.
The new of the AppenderCollection.
Adds the elements of a collection to the current AppenderCollection.
The collection whose elements should be added to the end of the AppenderCollection.
The new of the AppenderCollection.
Sets the capacity to the actual number of elements.
Return the collection elements as an array
the array
is less than zero
-or-
is equal to or greater than .
is less than zero
-or-
is equal to or greater than .
Gets the number of elements actually contained in the AppenderCollection.
Gets a value indicating whether access to the collection is synchronized (thread-safe).
true if access to the ICollection is synchronized (thread-safe); otherwise, false.
Gets an object that can be used to synchronize access to the collection.
Gets or sets the at the specified index.
The zero-based index of the element to get or set.
is less than zero
-or-
is equal to or greater than .
Gets a value indicating whether the collection has a fixed size.
true if the collection has a fixed size; otherwise, false. The default is false
Gets a value indicating whether the IList is read-only.
true if the collection is read-only; otherwise, false. The default is false
Gets or sets the number of elements the AppenderCollection can contain.
Supports type-safe iteration over a .
Advances the enumerator to the next element in the collection.
true if the enumerator was successfully advanced to the next element;
false if the enumerator has passed the end of the collection.
The collection was modified after the enumerator was created.
Sets the enumerator to its initial position, before the first element in the collection.
Gets the current element in the collection.
Type visible only to our subclasses
Used to access protected constructor
A value
Supports simple iteration over a .
Initializes a new instance of the Enumerator class.
Advances the enumerator to the next element in the collection.
true if the enumerator was successfully advanced to the next element;
false if the enumerator has passed the end of the collection.
The collection was modified after the enumerator was created.
Sets the enumerator to its initial position, before the first element in the collection.
Gets the current element in the collection.
Appends log events to the ASP.NET system.
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 or
method depending on the level of the logging event.
Nicko Cadell
Gert Driesen
Initializes a new instance of the class.
Default constructor.
Write the logging event to the ASP.NET trace
the event to log
Write the logging event to the ASP.NET trace
HttpContext.Current.Trace
().
This appender requires a to be set.
true
This appender requires a to be set.
Buffers events and then forwards them to attached appenders.
The events are buffered in this appender until conditions are
met to allow the appender to deliver the events to the attached
appenders. See for the
conditions that cause the buffer to be sent.
The forwarding appender can be used to specify different
thresholds and filters for the same appender at different locations
within the hierarchy.
Nicko Cadell
Gert Driesen
Interface for attaching appenders to objects.
Interface for attaching, removing and retrieving appenders.
Nicko Cadell
Gert Driesen
Attaches an appender.
The appender to add.
Add the specified appender. The implementation may
choose to allow or deny duplicate appenders.
Gets an attached appender with the specified name.
The name of the appender to get.
The appender with the name specified, or null if no appender with the
specified name is found.
Returns an attached appender with the specified.
If no appender with the specified name is found null will be
returned.
Removes all attached appenders.
Removes and closes all attached appenders
Removes the specified appender from the list of attached appenders.
The appender to remove.
The appender removed from the list
The appender removed is not closed.
If you are discarding the appender you must call
on the appender removed.
Removes the appender with the specified name from the list of appenders.
The name of the appender to remove.
The appender removed from the list
The appender removed is not closed.
If you are discarding the appender you must call
on the appender removed.
Gets all attached appenders.
A collection of attached appenders.
Gets a collection of attached appenders.
If there are no attached appenders the
implementation should return an empty
collection rather than null.
Initializes a new instance of the class.
Default constructor.
Closes the appender and releases resources.
Releases any resources allocated within the appender such as file handles,
network connections, etc.
It is a programming error to append to a closed appender.
Send the events.
The events that need to be send.
Forwards the events to the attached appenders.
Adds an to the list of appenders of this
instance.
The to add to this appender.
If the specified is already in the list of
appenders, then it won't be added again.
Looks for the appender with the specified name.
The name of the appender to lookup.
The appender with the specified name, or null.
Get the named appender attached to this buffering appender.
Removes all previously added appenders from this appender.
This is useful when re-reading configuration information.
Removes the specified appender from the list of appenders.
The appender to remove.
The appender removed from the list
The appender removed is not closed.
If you are discarding the appender you must call
on the appender removed.
Removes the appender with the specified name from the list of appenders.
The name of the appender to remove.
The appender removed from the list
The appender removed is not closed.
If you are discarding the appender you must call
on the appender removed.
Implementation of the interface
Gets the appenders contained in this appender as an
.
If no appenders can be found, then an
is returned.
A collection of the appenders in this appender.
Appends logging events to the console.
ColoredConsoleAppender appends log events to the standard output stream
or the error output stream using a layout specified by the
user. It also allows the color of a specific type of message to be set.
By default, all output is written to the console's standard output stream.
The property can be set to direct the output to the
error stream.
NOTE: This appender writes directly to the application's attached console
not to the System.Console.Out or System.Console.Error TextWriter.
The System.Console.Out and System.Console.Error streams can be
programmatically redirected (for example NUnit does this to capture program output).
This appender will ignore these redirections because it needs to use Win32
API calls to colorize the output. To respect these redirections the
must be used.
When configuring the colored console appender, mapping should be
specified to map a logging level to a color. For example:
The Level is the standard log4net logging level and ForeColor and BackColor can be any
combination of the following values:
- Blue
- Green
- Red
- White
- Yellow
- Purple
- Cyan
- HighIntensity
Rick Hobbs
Nicko Cadell
The to use when writing to the Console
standard output stream.
The to use when writing to the Console
standard output stream.
The to use when writing to the Console
standard error output stream.
The to use when writing to the Console
standard error output stream.
Initializes a new instance of the class.
The instance of the class is set up to write
to the standard output stream.
Initializes a new instance of the class
with the specified layout.
the layout to use for this appender
The instance of the class is set up to write
to the standard output stream.
Initializes a new instance of the class
with the specified layout.
the layout to use for this appender
flag set to true to write to the console error stream
When is set to true, output is written to
the standard error output stream. Otherwise, output is written to the standard
output stream.
Add a mapping of level to color - done by the config file
The mapping to add
Add a mapping to this appender.
Each mapping defines the foreground and background colors
for a level.
This method is called by the method.
The event to log.
Writes the event to the console.
The format of the output will depend on the appender's layout.
Initialize the options for this appender
Initialize the level to color mappings set on this appender.
Flag to write output to the error stream rather than the standard output stream
Mapping from level object to color value
The console output stream writer to write to
This writer is not thread safe.
Target is the value of the console output stream.
This is either "Console.Out" or "Console.Error".
Target is the value of the console output stream.
This is either "Console.Out" or "Console.Error".
Target is the value of the console output stream.
This is either "Console.Out" or "Console.Error".
This appender requires a to be set.
true
This appender requires a to be set.
The enum of possible color values for use with the color mapping method
The following flags can be combined together to
form the colors.
color is blue
color is green
color is red
color is white
color is yellow
color is purple
color is cyan
color is intensified
A class to act as a mapping between the level that a logging call is made at and
the color it should be displayed as.
Defines the mapping between a level and the color it should be displayed in.
Initialize the options for the object
Combine the and together.
The mapped foreground color for the specified level
Required property.
The mapped foreground color for the specified level.
The mapped background color for the specified level
Required property.
The mapped background color for the specified level.
The combined and suitable for
setting the console color.
Appends logging events to the console.
ConsoleAppender appends log events to the standard output stream
or the error output stream using a layout specified by the
user.
By default, all output is written to the console's standard output stream.
The property can be set to direct the output to the
error stream.
NOTE: This appender writes each message to the System.Console.Out or
System.Console.Error that is set at the time the event is appended.
Therefore it is possible to programmatically redirect the output of this appender
(for example NUnit does this to capture program output). While this is the desired
behavior of this appender it may have security implications in your application.
Nicko Cadell
Gert Driesen
The to use when writing to the Console
standard output stream.
The to use when writing to the Console
standard output stream.
The to use when writing to the Console
standard error output stream.
The to use when writing to the Console
standard error output stream.
Initializes a new instance of the class.
The instance of the class is set up to write
to the standard output stream.
Initializes a new instance of the class
with the specified layout.
the layout to use for this appender
The instance of the class is set up to write
to the standard output stream.
Initializes a new instance of the class
with the specified layout.
the layout to use for this appender
flag set to true to write to the console error stream
When is set to true, output is written to
the standard error output stream. Otherwise, output is written to the standard
output stream.
This method is called by the method.
The event to log.
Writes the event to the console.
The format of the output will depend on the appender's layout.
Target is the value of the console output stream.
This is either "Console.Out" or "Console.Error".
Target is the value of the console output stream.
This is either "Console.Out" or "Console.Error".
Target is the value of the console output stream.
This is either "Console.Out" or "Console.Error".
This appender requires a to be set.
true
This appender requires a to be set.
Appends log events to the system.
The application configuration file can be used to control what listeners
are actually used. See the MSDN documentation for the
class for details on configuring the
debug system.
Events are written using the
method. The event's logger name is passed as the value for the category name to the Write method.
Nicko Cadell
Initializes a new instance of the .
Default constructor.
Initializes a new instance of the
with a specified layout.
The layout to use with this appender.
Obsolete constructor.
Writes the logging event to the system.
The event to log.
Writes the logging event to the system.
If is true then the
is called.
Immediate flush means that the underlying writer or output stream
will be flushed at the end of each append operation.
Immediate flush is slower but ensures that each append request is
actually written. If is set to
false, then there is a good chance that the last few
logs events are not actually written to persistent media if and
when the application crashes.
The default value is true.
Gets or sets a value that indicates whether the appender will
flush at the end of each write.
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.
This appender requires a to be set.
true
This appender requires a to be set.
Writes events to the system event log.
The EventID of the event log entry can be
set using the EventLogEventID property ()
on the .
There is a limit of 32K characters for an event log message
When configuring the EventLogAppender a mapping can be
specified to map a logging level to an event log entry type. For example:
<mapping>
<level value="ERROR" />
<eventLogEntryType value="Error" />
</mapping>
<mapping>
<level value="DEBUG" />
<eventLogEntryType value="Information" />
</mapping>
The Level is the standard log4net logging level and eventLogEntryType can be any value
from the enum, i.e.:
- Erroran error event
- Warninga warning event
- Informationan informational event
Aspi Havewala
Douglas de la Torre
Nicko Cadell
Gert Driesen
Thomas Voss
Initializes a new instance of the class.
Default constructor.
Initializes a new instance of the class
with the specified .
The to use with this appender.
Obsolete constructor.
Add a mapping of level to - done by the config file
The mapping to add
Add a mapping to this appender.
Each mapping defines the event log entry type for a level.
Initialize the appender based on the options set
This is part of the delayed object
activation scheme. The method must
be called on this object after the configuration properties have
been set. Until is called this
object is in an undefined state and must not be used.
If any of the configuration properties are modified then
must be called again.
Create an event log source
Uses different API calls under NET_2_0
This method is called by the
method.
the event to log
Writes the event to the system event log using the
.
If the event has an EventID property (see )
set then this integer will be used as the event log event id.
There is a limit of 32K characters for an event log message
Get the equivalent for a
the Level to convert to an EventLogEntryType
The equivalent for a
Because there are fewer applicable
values to use in logging levels than there are in the
this is a one way mapping. There is
a loss of information during the conversion.
The log name is the section in the event logs where the messages
are stored.
Name of the application to use when logging. This appears in the
application column of the event log named by .
The name of the machine which holds the event log. This is
currently only allowed to be '.' i.e. the current machine.
Mapping from level object to EventLogEntryType
The security context to use for privileged calls
The name of the log where messages will be stored.
The string name of the log where messages will be stored.
This is the name of the log as it appears in the Event Viewer
tree. The default value is to log into the Application
log, this is where most applications write their events. However
if you need a separate log for your application (or applications)
then you should set the appropriately.
This should not be used to distinguish your event log messages
from those of other applications, the
property should be used to distinguish events. This property should be
used to group together events into a single log.
Property used to set the Application name. This appears in the
event logs when logging.
The string used to distinguish events from different sources.
Sets the event log source property.
This property is used to return the name of the computer to use
when accessing the event logs. Currently, this is the current
computer, denoted by a dot "."
The string name of the machine holding the event log that
will be logged into.
This property cannot be changed. It is currently set to '.'
i.e. the local machine. This may be changed in future.
Gets or sets the used to write to the EventLog.
The used to write to the EventLog.
The system security context used to write to the EventLog.
Unless a specified here for this appender
the is queried for the
security context to use. The default behavior is to use the security context
of the current thread.
This appender requires a to be set.
true
This appender requires a to be set.
A class to act as a mapping between the level that a logging call is made at and
the color it should be displayed as.
Defines the mapping between a level and its event log entry type.
The for this entry
Required property.
The for this entry
Appends logging events to a file.
Logging events are sent to the file specified by
the property.
The file can be opened in either append or overwrite mode
by specifying the property.
If the file path is relative it is taken as relative from
the application base directory. The file encoding can be
specified by setting the property.
The layout's and
values will be written each time the file is opened and closed
respectively. If the property is
then the file may contain multiple copies of the header and footer.
This appender will first try to open the file for writing when
is called. This will typically be during configuration.
If the file cannot be opened for writing the appender will attempt
to open the file again each time a message is logged to the appender.
If the file cannot be opened for writing when a message is logged then
the message will be discarded by this appender.
The supports pluggable file locking models via
the property.
The default behavior, implemented by
is to obtain an exclusive write lock on the file until this appender is closed.
The alternative model, , only holds a
write lock while the appender is writing a logging event.
Nicko Cadell
Gert Driesen
Rodrigo B. de Oliveira
Douglas de la Torre
Niall Daley
Sends logging events to a .
An Appender that writes to a .
This appender may be used stand alone if initialized with an appropriate
writer, however it is typically used as a base class for an appender that
can open a to write to.
Nicko Cadell
Gert Driesen
Douglas de la Torre
Initializes a new instance of the class.
Default constructor.
Initializes a new instance of the class and
sets the output destination to a new initialized
with the specified .
The layout to use with this appender.
The to output to.
Obsolete constructor.
Initializes a new instance of the class and sets
the output destination to the specified .
The layout to use with this appender
The to output to
The must have been previously opened.
Obsolete constructor.
This method determines if there is a sense in attempting to append.
This method checked if an output target has been set and if a
layout has been set.
false if any of the preconditions fail.
This method is called by the
method.
The event to log.
Writes a log statement to the output stream if the output stream exists
and is writable.
The format of the output will depend on the appender's layout.
This method is called by the
method.
The array of events to log.
This method writes all the bulk logged events to the output writer
before flushing the stream.
Close this appender instance. The underlying stream or writer is also closed.
Closed appenders cannot be reused.
Writes the footer and closes the underlying .
Writes the footer and closes the underlying .
Closes the underlying .
Closes the underlying .
Clears internal references to the underlying
and other variables.
Subclasses can override this method for an alternate closing behavior.
Writes a footer as produced by the embedded layout's property.
Writes a footer as produced by the embedded layout's property.
Writes a header produced by the embedded layout's property.
Writes a header produced by the embedded layout's property.
Called to allow a subclass to lazily initialize the writer
This method is called when an event is logged and the or
have not been set. This allows a subclass to
attempt to initialize the writer multiple times.
This is the where logging events
will be written to.
Immediate flush means that the underlying
or output stream will be flushed at the end of each append operation.
Immediate flush is slower but ensures that each append request is
actually written. If is set to
false, then there is a good chance that the last few
logging events are not actually persisted if and when the application
crashes.
The default value is true.
Gets or set whether the appender will flush at the end
of each append operation.
The default behavior is to flush at the end of each
append operation.
If this option is set to false, then the underlying
stream can defer persisting the logging event 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.
Sets the where the log output will go.
The specified must be open and writable.
The will be closed when the appender
instance is closed.
Note: Logging to an unopened will fail.
Gets or set the and the underlying
, if any, for this appender.
The for this appender.
This appender requires a to be set.
true
This appender requires a to be set.
Gets or sets the where logging events
will be written to.
The where logging events are written.
This is the where logging events
will be written to.
Default constructor
Default constructor
Construct a new appender using the layout, file and append mode.
the layout to use with this appender
the full path to the file to write to
flag to indicate if the file should be appended to
Obsolete constructor.
Construct a new appender using the layout and file specified.
The file will be appended to.
the layout to use with this appender
the full path to the file to write to
Obsolete constructor.
Activate the options on the file appender.
This is part of the delayed object
activation scheme. The method must
be called on this object after the configuration properties have
been set. Until is called this
object is in an undefined state and must not be used.
If any of the configuration properties are modified then
must be called again.
This will cause the file to be opened.
Closes any previously opened file and calls the parent's .
Resets the filename and the file stream.
Called to initialize the file writer
Will be called for each logged message until the file is
successfully opened.
This method is called by the
method.
The event to log.
Writes a log statement to the output stream if the output stream exists
and is writable.
The format of the output will depend on the appender's layout.
This method is called by the
method.
The array of events to log.
Acquires the output file locks once before writing all the events to
the stream.
Writes a footer as produced by the embedded layout's property.
Writes a footer as produced by the embedded layout's property.
Writes a header produced by the embedded layout's property.
Writes a header produced by the embedded layout's property.
Closes the underlying .
Closes the underlying .
Closes the previously opened file.
Writes the to the file and then
closes the file.
Sets and opens the file where the log output will go. The specified file must be writable.
The path to the log file. Must be a fully qualified path.
If true will append to fileName. Otherwise will truncate fileName
Calls but guarantees not to throw an exception.
Errors are passed to the .
Sets and opens the file where the log output will go. The specified file must be writable.
The path to the log file. Must be a fully qualified path.
If true will append to fileName. Otherwise will truncate fileName
If there was already an opened file, then the previous file
is closed first.
This method will ensure that the directory structure
for the specified exists.
Sets the quiet writer used for file output
the file stream that has been opened for writing
This implementation of creates a
over the and passes it to the
method.
This method can be overridden by sub classes that want to wrap the
in some way, for example to encrypt the output
data using a System.Security.Cryptography.CryptoStream.
Sets the quiet writer being used.
the writer over the file stream that has been opened for writing
This method can be overridden by sub classes that want to
wrap the in some way.
Convert a path into a fully qualified path.
The path to convert.
The fully qualified path.
Converts the path specified to a fully
qualified path. If the path is relative it is
taken as relative from the application base
directory.
Flag to indicate if we should append to the file
or overwrite the file. The default is to append.
The name of the log file.
The encoding to use for the file stream.
The security context to use for privileged calls
The stream to log to. Has added locking semantics
The locking model to use
Gets or sets the path to the file that logging will be written to.
The path to the file that logging will be written to.
If the path is relative it is taken as relative from
the application base directory.
Gets or sets a flag that indicates whether the file should be
appended to or overwritten.
Indicates whether the file should be appended to or overwritten.
If the value is set to false then the file will be overwritten, if
it is set to true then the file will be appended to.
The default value is true.
Gets or sets used to write to the file.
The used to write to the file.
The default encoding set is
which is the encoding for the system's current ANSI code page.
Gets or sets the used to write to the file.
The used to write to the file.
Unless a specified here for this appender
the is queried for the
security context to use. The default behavior is to use the security context
of the current thread.
Gets or sets the used to handle locking of the file.
The used to lock the file.
Gets or sets the used to handle locking of the file.
There are two built in locking models, and .
The former locks the file from the start of logging to the end and the
later lock only for the minimal amount of time when logging each message.
The default locking model is the .
Write only that uses the
to manage access to an underlying resource.
True asynchronous writes are not supported, the implementation forces a synchronous write.
Exception base type for log4net.
This type extends . It
does not add any new functionality but does differentiate the
type of exception being thrown.
Nicko Cadell
Gert Driesen
Constructor
Initializes a new instance of the class.
Constructor
A message to include with the exception.
Initializes a new instance of the class with
the specified message.
Constructor
A message to include with the exception.
A nested exception to include.
Initializes a new instance of the class
with the specified message and inner exception.
Serialization constructor
The that holds the serialized object data about the exception being thrown.
The that contains contextual information about the source or destination.
Initializes a new instance of the class
with serialized data.
Locking model base class
Base class for the locking models available to the derived loggers.
Open the output file
The filename to use
Whether to append to the file, or overwrite
The encoding to use
Open the file specified and prepare for logging.
No writes will be made until is called.
Must be called before any calls to ,
and .
Close the file
Close the file. No further writes will be made.
Acquire the lock on the file
A stream that is ready to be written to.
Acquire the lock on the file in preparation for writing to it.
Return a stream pointing to the file.
must be called to release the lock on the output file.
Release the lock on the file
Release the lock on the file. No further writes will be made to the
stream until is called again.
Gets or sets the for this LockingModel
The for this LockingModel
The file appender this locking model is attached to and working on
behalf of.
The file appender is used to locate the security context and the error handler to use.
The value of this property will be set before is
called.
Hold an exclusive lock on the output file
Open the file once for writing and hold it open until is called.
Maintains an exclusive lock on the file during this time.
Open the file specified and prepare for logging.
The filename to use
Whether to append to the file, or overwrite
The encoding to use
Open the file specified and prepare for logging.
No writes will be made until is called.
Must be called before any calls to ,
and .
Close the file
Close the file. No further writes will be made.
Acquire the lock on the file
A stream that is ready to be written to.
Does nothing. The lock is already taken
Release the lock on the file
Does nothing. The lock will be released when the file is closed.
Acquires the file lock for each write
Opens the file once for each / cycle,
thus holding the lock for the minimal amount of time. This method of locking
is considerably slower than but allows
other processes to move/delete the log file whilst logging continues.
Prepares to open the file when the first message is logged.
The filename to use
Whether to append to the file, or overwrite
The encoding to use
Open the file specified and prepare for logging.
No writes will be made until is called.
Must be called before any calls to ,
and .
Close the file
Close the file. No further writes will be made.
Acquire the lock on the file
A stream that is ready to be written to.
Acquire the lock on the file in preparation for writing to it.
Return a stream pointing to the file.
must be called to release the lock on the output file.
Release the lock on the file
Release the lock on the file. No further writes will be made to the
stream until is called again.
This appender forwards logging events to attached appenders.
The forwarding appender can be used to specify different thresholds
and filters for the same appender at different locations within the hierarchy.
Nicko Cadell
Gert Driesen
Initializes a new instance of the class.
Default constructor.
Closes the appender and releases resources.
Releases any resources allocated within the appender such as file handles,
network connections, etc.
It is a programming error to append to a closed appender.
Forward the logging event to the attached appenders
The event to log.
Delivers the logging event to all the attached appenders.
Forward the logging events to the attached appenders
The array of events to log.
Delivers the logging events to all the attached appenders.
Adds an to the list of appenders of this
instance.
The to add to this appender.
If the specified is already in the list of
appenders, then it won't be added again.
Looks for the appender with the specified name.
The name of the appender to lookup.
The appender with the specified name, or null.
Get the named appender attached to this appender.
Removes all previously added appenders from this appender.
This is useful when re-reading configuration information.
Removes the specified appender from the list of appenders.
The appender to remove.
The appender removed from the list
The appender removed is not closed.
If you are discarding the appender you must call
on the appender removed.
Removes the appender with the specified name from the list of appenders.
The name of the appender to remove.
The appender removed from the list
The appender removed is not closed.
If you are discarding the appender you must call
on the appender removed.
Implementation of the interface
Gets the appenders contained in this appender as an
.
If no appenders can be found, then an
is returned.
A collection of the appenders in this appender.
Logs events to a local syslog service.
This appender uses the POSIX libc library functions openlog, syslog, and closelog.
If these functions are not available on the local system then this appender will not work!
The functions openlog, syslog, and closelog are specified in SUSv2 and
POSIX 1003.1-2001 standards. These are used to log messages to the local syslog service.
This appender talks to a local syslog service. If you need to log to a remote syslog
daemon and you cannot configure your local syslog service to do this you may be
able to use the to log via UDP.
Syslog messages must have a facility and and a severity. The severity
is derived from the Level of the logging event.
The facility must be chosen from the set of defined syslog
values. The facilities list is predefined
and cannot be extended.
An identifier is specified with each log message. This can be specified
by setting the property. The identity (also know
as the tag) must not contain white space. The default value for the
identity is the application name (from ).
Rob Lyon
Nicko Cadell
Initializes a new instance of the class.
This instance of the class is set up to write
to a local syslog service.
Add a mapping of level to severity
The mapping to add
Adds a to this appender.
Initialize the appender based on the options set.
This is part of the delayed object
activation scheme. The method must
be called on this object after the configuration properties have
been set. Until is called this
object is in an undefined state and must not be used.
If any of the configuration properties are modified then
must be called again.
This method is called by the method.
The event to log.
Writes the event to a remote syslog daemon.
The format of the output will depend on the appender's layout.
Close the syslog when the appender is closed
Close the syslog when the appender is closed
Translates a log4net level to a syslog severity.
A log4net level.
A syslog severity.
Translates a log4net level to a syslog severity.
Generate a syslog priority.
The syslog facility.
The syslog severity.
A syslog priority.
The facility. The default facility is .
The message identity
Marshaled handle to the identity string. We have to hold on to the
string as the openlog and syslog APIs just hold the
pointer to the ident and dereference it for each log message.
Mapping from level object to syslog severity
Open connection to system logger.
Generate a log message.
The libc syslog method takes a format string and a variable argument list similar
to the classic printf function. As this type of vararg list is not supported
by C# we need to specify the arguments explicitly. Here we have specified the
format string with a single message argument. The caller must set the format
string to "%s".
Close descriptor used to write to system logger.
Message identity
An identifier is specified with each log message. This can be specified
by setting the property. The identity (also know
as the tag) must not contain white space. The default value for the
identity is the application name (from ).
Syslog facility
Set to one of the values. The list of
facilities is predefined and cannot be extended. The default value
is .
This appender requires a to be set.
true
This appender requires a to be set.
syslog severities
The log4net Level maps to a syslog severity using the
method and the
class. The severity is set on .
system is unusable
action must be taken immediately
critical conditions
error conditions
warning conditions
normal but significant condition
informational
debug-level messages
syslog facilities
The syslog facility defines which subsystem the logging comes from.
This is set on the property.
kernel messages
random user-level messages
mail system
system daemons
security/authorization messages
messages generated internally by syslogd
line printer subsystem
network news subsystem
UUCP subsystem
clock (cron/at) daemon
security/authorization messages (private)
ftp daemon
NTP subsystem
log audit
log alert
clock daemon
reserved for local use
reserved for local use
reserved for local use
reserved for local use
reserved for local use
reserved for local use
reserved for local use
reserved for local use
A class to act as a mapping between the level that a logging call is made at and
the syslog severity that is should be logged at.
A class to act as a mapping between the level that a logging call is made at and
the syslog severity that is should be logged at.
The mapped syslog severity for the specified level
Required property.
The mapped syslog severity for the specified level
Stores logging events in an array.
The memory appender stores all the logging events
that are appended in an in-memory array.
Use the method to get
the current list of events that have been appended.
Use the method to clear the
current list of events.
Julian Biddle
Nicko Cadell
Gert Driesen
Initializes a new instance of the class.
Default constructor.
Gets the events that have been logged.
The events that have been logged
Gets the events that have been logged.
This method is called by the method.
the event to log
Stores the in the events list.
Clear the list of events
Clear the list of events
The list of events that have been appended.
Value indicating which fields in the event should be fixed
By default all fields are fixed
Gets or sets a value indicating whether only part of the logging event
data should be fixed.
true if the appender should only fix part of the logging event
data, otherwise false. The default is false.
Setting this property to true will cause only part of the event
data to be fixed and stored in the appender, hereby improving performance.
See for more information.
Gets or sets the fields that will be fixed in the event
The logging event needs to have certain thread specific values
captured before it can be buffered. See
for details.
Logs entries by sending network messages using the
native function.
You can send messages only to names that are active
on the network. If you send the message to a user name,
that user must be logged on and running the Messenger
service to receive the message.
The receiver will get a top most window displaying the
messages one at a time, therefore this appender should
not be used to deliver a high volume of messages.
The following table lists some possible uses for this appender :
Action
Property Value(s)
-
Send a message to a user account on the local machine
= <name of the local machine>
= <user name>
-
Send a message to a user account on a remote machine
= <name of the remote machine>
= <user name>
-
Send a message to a domain user account
= <name of a domain controller | uninitialized>
= <user name>
-
Send a message to all the names in a workgroup or domain
= <workgroup name | domain name>*
-
Send a message from the local machine to a remote machine
= <name of the local machine | uninitialized>
= <name of the remote machine>
Note : security restrictions apply for sending
network messages, see
for more information.
An example configuration section to log information
using this appender from the local machine, named
LOCAL_PC, to machine OPERATOR_PC :
Nicko Cadell
Gert Driesen
The DNS or NetBIOS name of the server on which the function is to execute.
The sender of the network message.
The message alias to which the message should be sent.
The security context to use for privileged calls
Initializes the appender.
The default constructor initializes all fields to their default values.
Initialize the appender based on the options set.
This is part of the delayed object
activation scheme. The method must
be called on this object after the configuration properties have
been set. Until is called this
object is in an undefined state and must not be used.
If any of the configuration properties are modified then
must be called again.
The appender will be ignored if no was specified.
The required property was not specified.
This method is called by the method.
The event to log.
Sends the event using a network message.
Sends a buffer of information to a registered message alias.
The DNS or NetBIOS name of the server on which the function is to execute.
The message alias to which the message buffer should be sent
The originator of the message.
The message text.
The length, in bytes, of the message text.
The following restrictions apply for sending network messages:
Platform
Requirements
-
Windows NT
No special group membership is required to send a network message.
Admin, Accounts, Print, or Server Operator group membership is required to
successfully send a network message on a remote server.
-
Windows 2000 or later
If you send a message on a domain controller that is running Active Directory,
access is allowed or denied based on the access control list (ACL) for the securable
object. The default ACL permits only Domain Admins and Account Operators to send a network message.
On a member server or workstation, only Administrators and Server Operators can send a network message.
For more information see Security Requirements for the Network Management Functions.
If the function succeeds, the return value is zero.
Gets or sets the sender of the message.
The sender of the message.
If this property is not specified, the message is sent from the local computer.
Gets or sets the message alias to which the message should be sent.
The recipient of the message.
This property should always be specified in order to send a message.
Gets or sets the DNS or NetBIOS name of the remote server on which the function is to execute.
DNS or NetBIOS name of the remote server on which the function is to execute.
For Windows NT 4.0 and earlier, the string should begin with \\.
If this property is not specified, the local computer is used.
Gets or sets the used to call the NetSend method.
The used to call the NetSend method.
Unless a specified here for this appender
the is queried for the
security context to use. The default behavior is to use the security context
of the current thread.
This appender requires a to be set.
true
This appender requires a to be set.
Appends log events to the OutputDebugString system.
OutputDebugStringAppender appends log events to the
OutputDebugString system.
The string is passed to the native OutputDebugString
function.
Nicko Cadell
Gert Driesen
Initializes a new instance of the class.
Default constructor.
Write the logging event to the output debug string API
the event to log
Write the logging event to the output debug string API
Stub for OutputDebugString native method
the string to output
Stub for OutputDebugString native method
This appender requires a to be set.
true
This appender requires a to be set.
Logs events to a remote syslog daemon.
The BSD syslog protocol is used to remotely log to
a syslog daemon. The syslogd listens for for messages
on UDP port 514.
The syslog UDP protocol is not authenticated. Most syslog daemons
do not accept remote log messages because of the security implications.
You may be able to use the LocalSyslogAppender to talk to a local
syslog service.
There is an RFC 3164 that claims to document the BSD Syslog Protocol.
This RFC can be seen here: http://www.faqs.org/rfcs/rfc3164.html.
This appender generates what the RFC calls an "Original Device Message",
i.e. does not include the TIMESTAMP or HOSTNAME fields. By observation
this format of message will be accepted by all current syslog daemon
implementations. The daemon will attach the current time and the source
hostname or IP address to any messages received.
Syslog messages must have a facility and and a severity. The severity
is derived from the Level of the logging event.
The facility must be chosen from the set of defined syslog
values. The facilities list is predefined
and cannot be extended.
An identifier is specified with each log message. This can be specified
by setting the property. The identity (also know
as the tag) must not contain white space. The default value for the
identity is the application name (from ).
Rob Lyon
Nicko Cadell
Sends logging events as connectionless UDP datagrams to a remote host or a
multicast group using an .
UDP guarantees neither that messages arrive, nor that they arrive in the correct order.
To view the logging results, a custom application can be developed that listens for logging
events.
When decoding events send via this appender remember to use the same encoding
to decode the events as was used to send the events. See the
property to specify the encoding to use.
This example shows how to log receive logging events that are sent
on IP address 244.0.0.1 and port 8080 to the console. The event is
encoded in the packet as a unicode string and it is decoded as such.
IPEndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, 0);
UdpClient udpClient;
byte[] buffer;
string loggingEvent;
try
{
udpClient = new UdpClient(8080);
while(true)
{
buffer = udpClient.Receive(ref remoteEndPoint);
loggingEvent = System.Text.Encoding.Unicode.GetString(buffer);
Console.WriteLine(loggingEvent);
}
}
catch(Exception e)
{
Console.WriteLine(e.ToString());
}
Dim remoteEndPoint as IPEndPoint
Dim udpClient as UdpClient
Dim buffer as Byte()
Dim loggingEvent as String
Try
remoteEndPoint = new IPEndPoint(IPAddress.Any, 0)
udpClient = new UdpClient(8080)
While True
buffer = udpClient.Receive(ByRef remoteEndPoint)
loggingEvent = System.Text.Encoding.Unicode.GetString(buffer)
Console.WriteLine(loggingEvent)
Wend
Catch e As Exception
Console.WriteLine(e.ToString())
End Try
An example configuration section to log information using this appender to the
IP 224.0.0.1 on port 8080:
Gert Driesen
Nicko Cadell
Initializes a new instance of the class.
The default constructor initializes all fields to their default values.
Initialize the appender based on the options set.
This is part of the delayed object
activation scheme. The method must
be called on this object after the configuration properties have
been set. Until is called this
object is in an undefined state and must not be used.
If any of the configuration properties are modified then
must be called again.
The appender will be ignored if no was specified or
an invalid remote or local TCP port number was specified.
The required property was not specified.
The TCP port number assigned to or is less than or greater than .
This method is called by the method.
The event to log.
Sends the event using an UDP datagram.
Exceptions are passed to the .
Closes the UDP connection and releases all resources associated with
this instance.
Disables the underlying and releases all managed
and unmanaged resources associated with the .
Initializes the underlying connection.
The underlying is initialized and binds to the
port number from which you intend to communicate.
Exceptions are passed to the .
The IP address of the remote host or multicast group to which
the logging event will be sent.
The TCP port number of the remote host or multicast group to
which the logging event will be sent.
The cached remote endpoint to which the logging events will be sent.
The TCP port number from which the will communicate.
The instance that will be used for sending the
logging events.
The encoding to use for the packet.
Gets or sets the IP address of the remote host or multicast group to which
the underlying should sent the logging event.
The IP address of the remote host or multicast group to which the logging event
will be sent.
Multicast addresses are identified by IP class D addresses (in the range 224.0.0.0 to
239.255.255.255). Multicast packets can pass across different networks through routers, so
it is possible to use multicasts in an Internet scenario as long as your network provider
supports multicasting.
Hosts that want to receive particular multicast messages must register their interest by joining
the multicast group. Multicast messages are not sent to networks where no host has joined
the multicast group. Class D IP addresses are used for multicast groups, to differentiate
them from normal host addresses, allowing nodes to easily detect if a message is of interest.
Static multicast addresses that are needed globally are assigned by IANA. A few examples are listed in the table below:
IP Address
Description
-
224.0.0.1
Sends a message to all system on the subnet.
-
224.0.0.2
Sends a message to all routers on the subnet.
-
224.0.0.12
The DHCP server answers messages on the IP address 224.0.0.12, but only on a subnet.
A complete list of actually reserved multicast addresses and their owners in the ranges
defined by RFC 3171 can be found at the IANA web site.
The address range 239.0.0.0 to 239.255.255.255 is reserved for administrative scope-relative
addresses. These addresses can be reused with other local groups. Routers are typically
configured with filters to prevent multicast traffic in this range from flowing outside
of the local network.
Gets or sets the TCP port number of the remote host or multicast group to which
the underlying should sent the logging event.
An integer value in the range to
indicating the TCP port number of the remote host or multicast group to which the logging event
will be sent.
The underlying will send messages to this TCP port number
on the remote host or multicast group.
The value specified is less than or greater than .
Gets or sets the TCP port number from which the underlying will communicate.
An integer value in the range to
indicating the TCP port number from which the underlying will communicate.
The underlying will bind to this port for sending messages.
Setting the value to 0 (the default) will cause the udp client not to bind to
a local port.
The value specified is less than or greater than .
Gets or sets used to write the packets.
The used to write the packets.
The used to write the packets.
Gets or sets the underlying .
The underlying .
creates a to send logging events
over a network. Classes deriving from can use this
property to get or set this . Use the underlying
returned from if you require access beyond that which
provides.
Gets or sets the cached remote endpoint to which the logging events should be sent.
The cached remote endpoint to which the logging events will be sent.
The method will initialize the remote endpoint
with the values of the and
properties.
This appender requires a to be set.
true
This appender requires a to be set.
Syslog port 514
Initializes a new instance of the class.
This instance of the class is set up to write
to a remote syslog daemon.
Add a mapping of level to severity
The mapping to add
Add a mapping to this appender.
This method is called by the method.
The event to log.
Writes the event to a remote syslog daemon.
The format of the output will depend on the appender's layout.
Initialize the options for this appender
Initialize the level to syslog severity mappings set on this appender.
Translates a log4net level to a syslog severity.
A log4net level.
A syslog severity.
Translates a log4net level to a syslog severity.
Generate a syslog priority.
The syslog facility.
The syslog severity.
A syslog priority.
Generate a syslog priority.
The facility. The default facility is .
The message identity
Mapping from level object to syslog severity
Message identity
An identifier is specified with each log message. This can be specified
by setting the property. The identity (also know
as the tag) must not contain white space. The default value for the
identity is the application name (from ).
Syslog facility
Set to one of the values. The list of
facilities is predefined and cannot be extended. The default value
is .
syslog severities
The syslog severities.
system is unusable
action must be taken immediately
critical conditions
error conditions
warning conditions
normal but significant condition
informational
debug-level messages
syslog facilities
The syslog facilities
kernel messages
random user-level messages
mail system
system daemons
security/authorization messages
messages generated internally by syslogd
line printer subsystem
network news subsystem
UUCP subsystem
clock (cron/at) daemon
security/authorization messages (private)
ftp daemon
NTP subsystem
log audit
log alert
clock daemon
reserved for local use
reserved for local use
reserved for local use
reserved for local use
reserved for local use
reserved for local use
reserved for local use
reserved for local use
A class to act as a mapping between the level that a logging call is made at and
the syslog severity that is should be logged at.
A class to act as a mapping between the level that a logging call is made at and
the syslog severity that is should be logged at.
The mapped syslog severity for the specified level
Required property.
The mapped syslog severity for the specified level
Delivers logging events to a remote logging sink.
This Appender is designed to deliver events to a remote sink.
That is any object that implements the
interface. It delivers the events using .NET remoting. The
object to deliver events to is specified by setting the
appenders property.
The RemotingAppender buffers events before sending them. This allows it to
make more efficient use of the remoting infrastructure.
Once the buffer is full the events are still not sent immediately.
They are scheduled to be sent using a pool thread. The effect is that
the send occurs asynchronously. This is very important for a
number of non obvious reasons. The remoting infrastructure will
flow thread local variables (stored in the ),
if they are marked as , across the
remoting boundary. If the server is not contactable then
the remoting infrastructure will clear the
objects from the . To prevent a logging failure from
having side effects on the calling application the remoting call must be made
from a separate thread to the one used by the application. A
thread is used for this. If no thread is available then
the events will block in the thread pool manager until a thread is available.
Because the events are sent asynchronously using pool threads it is possible to close
this appender before all the queued events have been sent.
When closing the appender attempts to wait until all the queued events have been sent, but
this will timeout after 30 seconds regardless.
If this appender is being closed because the
event has fired it may not be possible to send all the queued events. During process
exit the runtime limits the time that a
event handler is allowed to run for. If the runtime terminates the threads before
the queued events have been sent then they will be lost. To ensure that all events
are sent the appender must be closed before the application exits. See
for details on how to shutdown
log4net programmatically.
Nicko Cadell
Gert Driesen
Daniel Cazzulino
Initializes a new instance of the class.
Default constructor.
Initialize the appender based on the options set
This is part of the delayed object
activation scheme. The method must
be called on this object after the configuration properties have
been set. Until is called this
object is in an undefined state and must not be used.
If any of the configuration properties are modified then
must be called again.
Send the contents of the buffer to the remote sink.
The events are not sent immediately. They are scheduled to be sent
using a pool thread. The effect is that the send occurs asynchronously.
This is very important for a number of non obvious reasons. The remoting
infrastructure will flow thread local variables (stored in the ),
if they are marked as , across the
remoting boundary. If the server is not contactable then
the remoting infrastructure will clear the
objects from the . To prevent a logging failure from
having side effects on the calling application the remoting call must be made
from a separate thread to the one used by the application. A
thread is used for this. If no thread is available then
the events will block in the thread pool manager until a thread is available.
The events to send.
Override base class close.
This method waits while there are queued work items. The events are
sent asynchronously using work items. These items
will be sent once a thread pool thread is available to send them, therefore
it is possible to close the appender before all the queued events have been
sent.
This method attempts to wait until all the queued events have been sent, but this
method will timeout after 30 seconds regardless.
If the appender is being closed because the
event has fired it may not be possible to send all the queued events. During process
exit the runtime limits the time that a
event handler is allowed to run for.
A work item is being queued into the thread pool
A work item from the thread pool has completed
Send the contents of the buffer to the remote sink.
This method is designed to be used with the .
This method expects to be passed an array of
objects in the state param.
the logging events to send
The URL of the remote sink.
The local proxy (.NET remoting) for the remote logging sink.
The number of queued callbacks currently waiting or executing
Event used to signal when there are no queued work items
This event is set when there are no queued work items. In this
state it is safe to close the appender.
Gets or sets the URL of the well-known object that will accept
the logging events.
The well-known URL of the remote sink.
The URL of the remoting sink that will accept logging events.
The sink must implement the
interface.
Interface used to deliver objects to a remote sink.
This interface must be implemented by a remoting sink
if the is to be used
to deliver logging events to the sink.
Delivers logging events to the remote sink
Array of events to log.
Delivers logging events to the remote sink
Appender that rolls log files based on size or date or both.
RollingFileAppender can roll log files based on size or date or both
depending on the setting of the property.
When set to the log file will be rolled
once its size exceeds the .
When set to the log file will be rolled
once the date boundary specified in the property
is crossed.
When set to the log file will be
rolled once the date boundary specified in the property
is crossed, but within a date boundary the file will also be rolled
once its size exceeds the .
When set to the log file will be rolled when
the appender is configured. This effectively means that the log file can be
rolled once per program execution.
A of few additional optional features have been added:
- Attach date pattern for current log file
- Backup number increments for newer files
- Infinite number of backups by file size
For large or infinite numbers of backup files a
greater than zero is highly recommended, otherwise all the backup files need
to be renamed each time a new backup is created.
When Date/Time based rolling is used setting
to will reduce the number of file renamings to few or none.
Changing or without clearing
the log file directory of backup files will cause unexpected and unwanted side effects.
If Date/Time based rolling is enabled this appender will attempt to roll existing files
in the directory without a Date/Time tag based on the last write date of the base log file.
The appender only rolls the log file when a message is logged. If Date/Time based rolling
is enabled then the appender will not roll the log file at the Date/Time boundary but
at the point when the next message is logged after the boundary has been crossed.
The extends the and
has the same behavior when opening the log file.
The appender will first try to open the file for writing when
is called. This will typically be during configuration.
If the file cannot be opened for writing the appender will attempt
to open the file again each time a message is logged to the appender.
If the file cannot be opened for writing when a message is logged then
the message will be discarded by this appender.
When rolling a backup file necessitates deleting an older backup file the
file to be deleted is moved to a temporary name before being deleted.
A maximum number of backup files when rolling on date/time boundaries is not supported.
Nicko Cadell
Gert Driesen
Aspi Havewala
Douglas de la Torre
Edward Smit
Initializes a new instance of the class.
Default constructor.
Sets the quiet writer being used.
This method can be overridden by sub classes.
the writer to set
Write out a logging event.
the event to write to file.
Handles append time behavior for RollingFileAppender. This checks
if a roll over either by date (checked first) or time (checked second)
is need and then appends to the file last.
Write out an array of logging events.
the events to write to file.
Handles append time behavior for RollingFileAppender. This checks
if a roll over either by date (checked first) or time (checked second)
is need and then appends to the file last.
Performs any required rolling before outputting the next event
Handles append time behavior for RollingFileAppender. This checks
if a roll over either by date (checked first) or time (checked second)
is need and then appends to the file last.
Creates and opens the file for logging. If
is false then the fully qualified name is determined and used.
the name of the file to open
true to append to existing file
This method will ensure that the directory structure
for the specified exists.
Get the current output file name
the base file name
the output file name
The output file name is based on the base fileName specified.
If is set then the output
file name is the same as the base file passed in. Otherwise
the output file depends on the date pattern, on the count
direction or both.
Determines curSizeRollBackups (only within the current roll point)
Generates a wildcard pattern that can be used to find all files
that are similar to the base file name.
Builds a list of filenames for all files matching the base filename plus a file
pattern.
Initiates a roll over if needed for crossing a date boundary since the last run.
Initializes based on existing conditions at time of .
Initializes based on existing conditions at time of .
The following is done
- determine curSizeRollBackups (only within the current roll point)
- initiates a roll over if needed for crossing a date boundary since the last run.
Does the work of bumping the 'current' file counter higher
to the highest count when an incremental file name is seen.
The highest count is either the first file (when count direction
is greater than 0) or the last file (when count direction less than 0).
In either case, we want to know the highest count that is present.
Takes a list of files and a base file name, and looks for
'incremented' versions of the base file. Bumps the max
count up to the highest count seen.
Calculates the RollPoint for the datePattern supplied.
the date pattern to calculate the check period for
The RollPoint that is most accurate for the date pattern supplied
Essentially the date pattern is examined to determine what the
most suitable roll point is. The roll point chosen is the roll point
with the smallest period that can be detected using the date pattern
supplied. i.e. if the date pattern only outputs the year, month, day
and hour then the smallest roll point that can be detected would be
and hourly roll point as minutes could not be detected.
Initialize the appender based on the options set
This is part of the delayed object
activation scheme. The method must
be called on this object after the configuration properties have
been set. Until is called this
object is in an undefined state and must not be used.
If any of the configuration properties are modified then
must be called again.
Sets initial conditions including date/time roll over information, first check,
scheduledFilename, and calls to initialize
the current number of backups.
Rollover the file(s) to date/time tagged file(s).
set to true if the file to be rolled is currently open
Rollover the file(s) to date/time tagged file(s).
Resets curSizeRollBackups.
If fileIsOpen is set then the new file is opened (through SafeOpenFile).
Renames file to file .
Name of existing file to roll.
New name for file.
Renames file to file . It
also checks for existence of target file and deletes if it does.
Test if a file exists at a specified path
the path to the file
true if the file exists
Test if a file exists at a specified path
Deletes the specified file if it exists.
The file to delete.
Delete a file if is exists.
The file is first moved to a new filename then deleted.
This allows the file to be removed even when it cannot
be deleted, but it still can be moved.
Implements file roll base on file size.
If the maximum number of size based backups is reached
(curSizeRollBackups == maxSizeRollBackups) then the oldest
file is deleted -- its index determined by the sign of countDirection.
If countDirection < 0, then files
{File.1, ..., File.curSizeRollBackups -1}
are renamed to {File.2, ...,
File.curSizeRollBackups}. Moreover, File is
renamed File.1 and closed.
A new file is created to receive further log output.
If maxSizeRollBackups is equal to zero, then the
File is truncated with no backup files created.
If maxSizeRollBackups < 0, then File is
renamed if needed and no files are deleted.
Implements file roll.
the base name to rename
If the maximum number of size based backups is reached
(curSizeRollBackups == maxSizeRollBackups) then the oldest
file is deleted -- its index determined by the sign of countDirection.
If countDirection < 0, then files
{File.1, ..., File.curSizeRollBackups -1}
are renamed to {File.2, ...,
File.curSizeRollBackups}.
If maxSizeRollBackups is equal to zero, then the
File is truncated with no backup files created.
If maxSizeRollBackups < 0, then File is
renamed if needed and no files are deleted.
This is called by to rename the files.
Get the start time of the next window for the current rollpoint
the current date
the type of roll point we are working with
the start time for the next roll point an interval after the currentDateTime date
Returns the date of the next roll point after the currentDateTime date passed to the method.
The basic strategy is to subtract the time parts that are less significant
than the rollpoint from the current time. This should roll the time back to
the start of the time window for the current rollpoint. Then we add 1 window
worth of time and get the start time of the next window for the rollpoint.
This object supplies the current date/time. Allows test code to plug in
a method to control this class when testing date/time based rolling.
The date pattern. By default, the pattern is set to ".yyyy-MM-dd"
meaning daily rollover.
The actual formatted filename that is currently being written to
or will be the file transferred to on roll over
(based on staticLogFileName).
The timestamp when we shall next recompute the filename.
Holds date of last roll over
The type of rolling done
The default maximum file size is 10MB
There is zero backup files by default
How many sized based backups have been made so far
The rolling file count direction.
The rolling mode used in this appender.
Cache flag set if we are rolling by date.
Cache flag set if we are rolling by size.
Value indicating whether to always log to the same file.
FileName provided in configuration. Used for rolling properly
The 1st of January 1970 in UTC
Gets or sets the date pattern to be used for generating file names
when rolling over on date.
The date pattern to be used for generating file names when rolling
over on date.
Takes a string in the same format as expected by
.
This property determines the rollover schedule when rolling over
on date.
Gets or sets the maximum number of backup files that are kept before
the oldest is erased.
The maximum number of backup files that are kept before the oldest is
erased.
If set to zero, then there will be no backup files and the log file
will be truncated when it reaches .
If a negative number is supplied then no deletions will be made. Note
that this could result in very slow performance as a large number of
files are rolled over unless is used.
The maximum applies to each time based group of files and
not the total.
Gets or sets the maximum size that the output file is allowed to reach
before being rolled over to backup files.
The maximum size in bytes that the output file is allowed to reach before being
rolled over to backup files.
This property is equivalent to except
that it is required for differentiating the setter taking a
argument from the setter taking a
argument.
The default maximum file size is 10MB (10*1024*1024).
Gets or sets the maximum size that the output file is allowed to reach
before being rolled over to backup files.
The maximum size that the output file is allowed to reach before being
rolled over to backup files.
This property allows you to specify the maximum size with the
suffixes "KB", "MB" or "GB" so that the size is interpreted being
expressed respectively in kilobytes, megabytes or gigabytes.
For example, the value "10KB" will be interpreted as 10240 bytes.
The default maximum file size is 10MB.
If you have the option to set the maximum file size programmatically
consider using the property instead as this
allows you to set the size in bytes as a .
Gets or sets the rolling file count direction.
The rolling file count direction.
Indicates if the current file is the lowest numbered file or the
highest numbered file.
By default newer files have lower numbers ( < 0),
i.e. log.1 is most recent, log.5 is the 5th backup, etc...
>= 0 does the opposite i.e.
log.1 is the first backup made, log.5 is the 5th backup made, etc.
For infinite backups use >= 0 to reduce
rollover costs.
The default file count direction is -1.
Gets or sets the rolling style.
The rolling style.
The default rolling style is .
When set to this appender's
property is set to false, otherwise
the appender would append to a single file rather than rolling
the file each time it is opened.
Gets or sets a value indicating whether to always log to
the same file.
true if always should be logged to the same file, otherwise false.
By default file.log is always the current file. Optionally
file.log.yyyy-mm-dd for current formatted datePattern can by the currently
logging file (or file.log.curSizeRollBackup or even
file.log.yyyy-mm-dd.curSizeRollBackup).
This will make time based rollovers with a large number of backups
much faster as the appender it won't have to rename all the backups!
Style of rolling to use
Style of rolling to use
Roll files once per program execution
Roll files once per program execution.
Well really once each time this appender is
configured.
Setting this option also sets AppendToFile to
false on the RollingFileAppender, otherwise
this appender would just be a normal file appender.
Roll files based only on the size of the file
Roll files based only on the date
Roll files based on both the size and date of the file
The code assumes that the following 'time' constants are in a increasing sequence.
The code assumes that the following 'time' constants are in a increasing sequence.
Roll the log not based on the date
Roll the log for each minute
Roll the log for each hour
Roll the log twice a day (midday and midnight)
Roll the log each day (midnight)
Roll the log each week
Roll the log each month
This interface is used to supply Date/Time information to the .
This interface is used to supply Date/Time information to the .
Used primarily to allow test classes to plug themselves in so they can
supply test date/times.
Gets the current time.
The current time.
Gets the current time.
Default implementation of that returns the current time.
Gets the current time.
The current time.
Gets the current time.
Send an e-mail when a specific logging event occurs, typically on errors
or fatal errors.
The number of logging events delivered in this e-mail depend on
the value of option. The
keeps only the last
logging events in its
cyclic buffer. This keeps memory requirements at a reasonable level while
still delivering useful application context.
Authentication and setting the server Port are only available on the MS .NET 1.1 runtime.
For these features to be enabled you need to ensure that you are using a version of
the log4net assembly that is built against the MS .NET 1.1 framework and that you are
running the your application on the MS .NET 1.1 runtime. On all other platforms only sending
unauthenticated messages to a server listening on port 25 (the default) is supported.
Authentication is supported by setting the property to
either or .
If using authentication then the
and properties must also be set.
To set the SMTP server port use the property. The default port is 25.
Nicko Cadell
Gert Driesen
Default constructor
Default constructor
Sends the contents of the cyclic buffer as an e-mail message.
The logging events to send.
Send the email message
the body text to include in the mail
Gets or sets a semicolon-delimited list of recipient e-mail addresses.
A semicolon-delimited list of e-mail addresses.
A semicolon-delimited list of recipient e-mail addresses.
Gets or sets the e-mail address of the sender.
The e-mail address of the sender.
The e-mail address of the sender.
Gets or sets the subject line of the e-mail message.
The subject line of the e-mail message.
The subject line of the e-mail message.
Gets or sets the name of the SMTP relay mail server to use to send
the e-mail messages.
The name of the e-mail relay server. If SmtpServer is not set, the
name of the local SMTP server is used.
The name of the e-mail relay server. If SmtpServer is not set, the
name of the local SMTP server is used.
Obsolete
Use the BufferingAppenderSkeleton Fix methods instead
Obsolete property.
The mode to use to authentication with the SMTP server
Authentication is only available on the MS .NET 1.1 runtime.
Valid Authentication mode values are: ,
, and .
The default value is . When using
you must specify the
and to use to authenticate.
When using the Windows credentials for the current
thread, if impersonating, or the process will be used to authenticate.
The username to use to authenticate with the SMTP server
Authentication is only available on the MS .NET 1.1 runtime.
A and must be specified when
is set to ,
otherwise the username will be ignored.
The password to use to authenticate with the SMTP server
Authentication is only available on the MS .NET 1.1 runtime.
A and must be specified when
is set to ,
otherwise the password will be ignored.
The port on which the SMTP server is listening
Server Port is only available on the MS .NET 1.1 runtime.
The port on which the SMTP server is listening. The default
port is 25. The Port can only be changed when running on
the MS .NET 1.1 runtime.
Gets or sets the priority of the e-mail message
One of the values.
Sets the priority of the e-mails generated by this
appender. The default priority is .
If you are using this appender to report errors then
you may want to set the priority to .
This appender requires a to be set.
true
This appender requires a to be set.
Values for the property.
SMTP authentication modes.
No authentication
Basic authentication.
Requires a username and password to be supplied
Integrated authentication
Uses the Windows credentials from the current thread or process to authenticate.
Send an email when a specific logging event occurs, typically on errors
or fatal errors. Rather than sending via smtp it writes a file into the
directory specified by . This allows services such
as the IIS SMTP agent to manage sending the messages.
The configuration for this appender is identical to that of the SMTPAppender,
except that instead of specifying the SMTPAppender.SMTPHost you specify
.
The number of logging events delivered in this e-mail depend on
the value of option. The
keeps only the last
logging events in its
cyclic buffer. This keeps memory requirements at a reasonable level while
still delivering useful application context.
Niall Daley
Nicko Cadell
Default constructor
Default constructor
Sends the contents of the cyclic buffer as an e-mail message.
The logging events to send.
Sends the contents of the cyclic buffer as an e-mail message.
Activate the options on this appender.
This is part of the delayed object
activation scheme. The method must
be called on this object after the configuration properties have
been set. Until is called this
object is in an undefined state and must not be used.
If any of the configuration properties are modified then
must be called again.
Convert a path into a fully qualified path.
The path to convert.
The fully qualified path.
Converts the path specified to a fully
qualified path. If the path is relative it is
taken as relative from the application base
directory.
The security context to use for privileged calls
Gets or sets a semicolon-delimited list of recipient e-mail addresses.
A semicolon-delimited list of e-mail addresses.
A semicolon-delimited list of e-mail addresses.
Gets or sets the e-mail address of the sender.
The e-mail address of the sender.
The e-mail address of the sender.
Gets or sets the subject line of the e-mail message.
The subject line of the e-mail message.
The subject line of the e-mail message.
Gets or sets the path to write the messages to.
Gets or sets the path to write the messages to. This should be the same
as that used by the agent sending the messages.
Gets or sets the used to write to the pickup directory.
The used to write to the pickup directory.
Unless a specified here for this appender
the is queried for the
security context to use. The default behavior is to use the security context
of the current thread.
This appender requires a to be set.
true
This appender requires a to be set.
Appender that allows clients to connect via Telnet to receive log messages
The TelnetAppender accepts socket connections and streams logging messages
back to the client.
The output is provided in a telnet-friendly way so that a log can be monitored
over a TCP/IP socket.
This allows simple remote monitoring of application logging.
The default is 23 (the telnet port).
Keith Long
Nicko Cadell
Default constructor
Default constructor
Overrides the parent method to close the socket handler
Closes all the outstanding connections.
Initialize the appender based on the options set.
This is part of the delayed object
activation scheme. The method must
be called on this object after the configuration properties have
been set. Until is called this
object is in an undefined state and must not be used.
If any of the configuration properties are modified then
must be called again.
Create the socket handler and wait for connections
Writes the logging event to each connected client.
The event to log.
Writes the logging event to each connected client.
Gets or sets the TCP port number on which this will listen for connections.
An integer value in the range to
indicating the TCP port number on which this will listen for connections.
The default value is 23 (the telnet port).
The value specified is less than
or greater than .
This appender requires a to be set.
true
This appender requires a to be set.
Helper class to manage connected clients
The SocketHandler class is used to accept connections from
clients. It is threaded so that clients can connect/disconnect
asynchronously.
Opens a new server port on
the local port to listen on for connections
Creates a socket handler on the specified local server port.
Sends a string message to each of the connected clients
the text to send
Sends a string message to each of the connected clients
Add a client to the internal clients list
client to add
Remove a client from the internal clients list
client to remove
Callback used to accept a connection on the server socket
The result of the asynchronous operation
On connection adds to the list of connections
if there are two many open connections you will be disconnected
Close all network connections
Make sure we close all network connections
Test if this handler has active connections
true if this handler has active connections
This property will be true while this handler has
active connections, that is at least one connection that
the handler will attempt to send a message to.
Class that represents a client connected to this handler
Class that represents a client connected to this handler
Create this for the specified
the client's socket
Opens a stream writer on the socket.
Write a string to the client
string to send
Write a string to the client
Cleanup the clients connection
Close the socket connection.
Appends log events to the system.
The application configuration file can be used to control what listeners
are actually used. See the MSDN documentation for the
class for details on configuring the
trace system.
Events are written using the System.Diagnostics.Trace.Write(string,string)
method. The event's logger name is passed as the value for the category name to the Write method.
Compact Framework
The Compact Framework does not support the
class for any operation except Assert. When using the Compact Framework this
appender will write to the system rather than
the Trace system. This appender will therefore behave like the .
Douglas de la Torre
Nicko Cadell
Gert Driesen
Initializes a new instance of the .
Default constructor.
Initializes a new instance of the
with a specified layout.
The layout to use with this appender.
Obsolete constructor.
Writes the logging event to the system.
The event to log.
Writes the logging event to the system.
Immediate flush means that the underlying writer or output stream
will be flushed at the end of each append operation.
Immediate flush is slower but ensures that each append request is
actually written. If is set to
false, then there is a good chance that the last few
logs events are not actually written to persistent media if and
when the application crashes.
The default value is true.
Gets or sets a value that indicates whether the appender will
flush at the end of each write.
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.
This appender requires a to be set.
true
This appender requires a to be set.
Assembly level attribute that specifies a domain to alias to this assembly's repository.
AliasDomainAttribute is obsolete. Use AliasRepositoryAttribute instead of AliasDomainAttribute.
An assembly's logger repository is defined by its ,
however this can be overridden by an assembly loaded before the target assembly.
An assembly can alias another assembly's domain to its repository by
specifying this attribute with the name of the target domain.
This attribute can only be specified on the assembly and may be used
as many times as necessary to alias all the required domains.
Nicko Cadell
Gert Driesen
Assembly level attribute that specifies a repository to alias to this assembly's repository.
An assembly's logger repository is defined by its ,
however this can be overridden by an assembly loaded before the target assembly.
An assembly can alias another assembly's repository to its repository by
specifying this attribute with the name of the target repository.
This attribute can only be specified on the assembly and may be used
as many times as necessary to alias all the required repositories.
Nicko Cadell
Gert Driesen
Initializes a new instance of the class with
the specified repository to alias to this assembly's repository.
The repository to alias to this assemby's repository.
Initializes a new instance of the class with
the specified repository to alias to this assembly's repository.
Gets or sets the repository to alias to this assemby's repository.
The repository to alias to this assemby's repository.
The name of the repository to alias to this assemby's repository.
Initializes a new instance of the class with
the specified domain to alias to this assembly's repository.
The domain to alias to this assemby's repository.
Obsolete. Use instead of .
Use this class to quickly configure a .
Allows very simple programmatic configuration of log4net.
Only one appender can be configured using this configurator.
The appender is set at the root of the hierarchy and all logging
events will be delivered to that appender.
Appenders can also implement the interface. Therefore
they would require that the method
be called after the appenders properties have been configured.
Nicko Cadell
Gert Driesen
Initializes a new instance of the class.
Uses a private access modifier to prevent instantiation of this class.
Initializes the log4net system with a default configuration.
Initializes the log4net logging system using a
that will write to Console.Out. The log messages are
formatted using the layout object
with the
layout style.
Initializes the log4net system using the specified appender.
The appender to use to log all logging events.
Initializes the log4net system using the specified appender.
Initializes the with a default configuration.
The repository to configure.
Initializes the specified repository using a
that will write to Console.Out. The log messages are
formatted using the layout object
with the
layout style.
Initializes the using the specified appender.
The repository to configure.
The appender to use to log all logging events.
Initializes the using the specified appender.
Base class for all log4net configuration attributes.
This is an abstract class that must be extended by
specific configurators. This attribute allows the
configurator to be parameterized by an assembly level
attribute.
Nicko Cadell
Gert Driesen
Constructor used by subclasses.
the ordering priority for this configurator
The is used to order the configurator
attributes before they are invoked. Higher priority configurators are executed
before lower priority ones.
Configures the for the specified assembly.
The assembly that this attribute was defined on.
The repository to configure.
Abstract method implemented by a subclass. When this method is called
the subclass should configure the .
Compare this instance to another ConfiguratorAttribute
the object to compare to
see
Compares the priorities of the two instances.
Sorts by priority in descending order. Objects with the same priority are
randomly ordered.
Assembly level attribute that specifies the logging domain for the assembly.
DomainAttribute is obsolete. Use RepositoryAttribute instead of DomainAttribute.
Assemblies are mapped to logging domains. Each domain has its own
logging repository. This attribute specified on the assembly controls
the configuration of the domain. The property specifies the name
of the domain that this assembly is a part of. The
specifies the type of the repository objects to create for the domain. If
this attribute is not specified and a is not specified
then the assembly will be part of the default shared logging domain.
This attribute can only be specified on the assembly and may only be used
once per assembly.
Nicko Cadell
Gert Driesen
Assembly level attribute that specifies the logging repository for the assembly.
Assemblies are mapped to logging repository. This attribute specified
on the assembly controls
the configuration of the repository. The property specifies the name
of the repository that this assembly is a part of. The
specifies the type of the object
to create for the assembly. If this attribute is not specified or a
is not specified then the assembly will be part of the default shared logging repository.
This attribute can only be specified on the assembly and may only be used
once per assembly.
Nicko Cadell
Gert Driesen
Initializes a new instance of the class.
Default constructor.
Initialize a new instance of the class
with the name of the repository.
The name of the repository.
Initialize the attribute with the name for the assembly's repository.
Gets or sets the name of the logging repository.
The string name to use as the name of the repository associated with this
assembly.
This value does not have to be unique. Several assemblies can share the
same repository. They will share the logging configuration of the repository.
Gets or sets the type of repository to create for this assembly.
The type of repository to create for this assembly.
The type of the repository to create for the assembly.
The type must implement the
interface.
This will be the type of repository created when
the repository is created. If multiple assemblies reference the
same repository then the repository is only created once using the
of the first assembly to call into the
repository.
Initializes a new instance of the class.
Obsolete. Use RepositoryAttribute instead of DomainAttribute.
Initialize a new instance of the class
with the name of the domain.
The name of the domain.
Obsolete. Use RepositoryAttribute instead of DomainAttribute.
Use this class to initialize the log4net environment using an Xml tree.
DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator.
Configures a using an Xml tree.
Nicko Cadell
Gert Driesen
Private constructor
Automatically configures the log4net system based on the
application's configuration settings.
DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator.
Each application has a configuration file. This has the
same name as the application with '.config' appended.
This file is XML and calling this function prompts the
configurator to look in that file for a section called
log4net that contains the configuration data.
Automatically configures the using settings
stored in the application's configuration file.
DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator.
Each application has a configuration file. This has the
same name as the application with '.config' appended.
This file is XML and calling this function prompts the
configurator to look in that file for a section called
log4net that contains the configuration data.
The repository to configure.
Configures log4net using a log4net element
DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator.
Loads the log4net configuration from the XML element
supplied as .
The element to parse.
Configures the using the specified XML
element.
DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator.
Loads the log4net configuration from the XML element
supplied as .
The repository to configure.
The element to parse.
Configures log4net using the specified configuration file.
The XML file to load the configuration from.
DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator.
The configuration file must be valid XML. It must contain
at least one element called log4net that holds
the log4net configuration data.
The log4net configuration file can possible be specified in the application's
configuration file (either MyAppName.exe.config for a
normal application on Web.config for an ASP.NET application).
The following example configures log4net using a configuration file, of which the
location is stored in the application's configuration file :
using log4net.Config;
using System.IO;
using System.Configuration;
...
DOMConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"]));
In the .config file, the path to the log4net can be specified like this :
Configures log4net using the specified configuration file.
A stream to load the XML configuration from.
DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator.
The configuration data must be valid XML. It must contain
at least one element called log4net that holds
the log4net configuration data.
Note that this method will NOT close the stream parameter.
Configures the using the specified configuration
file.
The repository to configure.
The XML file to load the configuration from.
DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator.
The configuration file must be valid XML. It must contain
at least one element called log4net that holds
the configuration data.
The log4net configuration file can possible be specified in the application's
configuration file (either MyAppName.exe.config for a
normal application on Web.config for an ASP.NET application).
The following example configures log4net using a configuration file, of which the
location is stored in the application's configuration file :
using log4net.Config;
using System.IO;
using System.Configuration;
...
DOMConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"]));
In the .config file, the path to the log4net can be specified like this :
Configures the using the specified configuration
file.
The repository to configure.
The stream to load the XML configuration from.
DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator.
The configuration data must be valid XML. It must contain
at least one element called log4net that holds
the configuration data.
Note that this method will NOT close the stream parameter.
Configures log4net using the file specified, monitors the file for changes
and reloads the configuration if a change is detected.
The XML file to load the configuration from.
DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator.
The configuration file must be valid XML. It must contain
at least one element called log4net that holds
the configuration data.
The configuration file will be monitored using a
and depends on the behavior of that class.
For more information on how to configure log4net using
a separate configuration file, see .
Configures the using the file specified,
monitors the file for changes and reloads the configuration if a change
is detected.
The repository to configure.
The XML file to load the configuration from.
DOMConfigurator is obsolete. Use XmlConfigurator instead of DOMConfigurator.
The configuration file must be valid XML. It must contain
at least one element called log4net that holds
the configuration data.
The configuration file will be monitored using a
and depends on the behavior of that class.
For more information on how to configure log4net using
a separate configuration file, see .
Assembly level attribute to configure the .
AliasDomainAttribute is obsolete. Use AliasRepositoryAttribute instead of AliasDomainAttribute.
This attribute may only be used at the assembly scope and can only
be used once per assembly.
Use this attribute to configure the
without calling one of the
methods.
Nicko Cadell
Gert Driesen
Assembly level attribute to configure the .
This attribute may only be used at the assembly scope and can only
be used once per assembly.
Use this attribute to configure the
without calling one of the
methods.
If neither of the or
properties are set the configuration is loaded from the application's .config file.
If set the property takes priority over the
property. The property
specifies a path to a file to load the config from. The path is relative to the
application's base directory; .
The property is used as a postfix to the assembly file name.
The config file must be located in the application's base directory; .
For example in a console application setting the to
config has the same effect as not specifying the or
properties.
The property can be set to cause the
to watch the configuration file for changes.
Log4net will only look for assembly level configuration attributes once.
When using the log4net assembly level attributes to control the configuration
of log4net you must ensure that the first call to any of the
methods is made from the assembly with the configuration
attributes.
If you cannot guarantee the order in which log4net calls will be made from
different assemblies you must use programmatic configuration instead, i.e.
call the method directly.
Nicko Cadell
Gert Driesen
Default constructor
Default constructor
Configures the for the specified assembly.
The assembly that this attribute was defined on.
The repository to configure.
Configure the repository using the .
The specified must extend the
class otherwise the will not be able to
configure it.
The does not extend .
Attempt to load configuration from the local file system
The assembly that this attribute was defined on.
The repository to configure.
Configure the specified repository using a
The repository to configure.
the FileInfo pointing to the config file
Attempt to load configuration from a URI
The assembly that this attribute was defined on.
The repository to configure.
Gets or sets the filename of the configuration file.
The filename of the configuration file.
If specified, this is the name of the configuration file to use with
the . This file path is relative to the
application base directory ().
The takes priority over the .
Gets or sets the extension of the configuration file.
The extension of the configuration file.
If specified this is the extension for the configuration file.
The path to the config file is built by using the application
base directory (),
the assembly file name and the config file extension.
If the is set to MyExt then
possible config file names would be: MyConsoleApp.exe.MyExt or
MyClassLibrary.dll.MyExt.
The takes priority over the .
Gets or sets a value indicating whether to watch the configuration file.
true if the configuration should be watched, false otherwise.
If this flag is specified and set to true then the framework
will watch the configuration file and will reload the config each time
the file is modified.
The config file can only be watched if it is loaded from local disk.
In a No-Touch (Smart Client) deployment where the application is downloaded
from a web server the config file may not reside on the local disk
and therefore it may not be able to watch it.
Watching configuration is not supported on the SSCLI.
Class to register for the log4net section of the configuration file
The log4net section of the configuration file needs to have a section
handler registered. This is the section handler used. It simply returns
the XML element that is the root of the section.
Example of registering the log4net section handler :
log4net configuration XML goes here
Nicko Cadell
Gert Driesen
Initializes a new instance of the class.
Default constructor.
Parses the configuration section.
The configuration settings in a corresponding parent configuration section.
The configuration context when called from the ASP.NET configuration system. Otherwise, this parameter is reserved and is a null reference.
The for the log4net section.
The for the log4net section.
Returns the containing the configuration data,
Assembly level attribute that specifies a plugin to attach to
the repository.
Specifies the type of a plugin to create and attach to the
assembly's repository. The plugin type must implement the
interface.
Nicko Cadell
Gert Driesen
Interface used to create plugins.
Interface used to create a plugin.
Nicko Cadell
Gert Driesen
Creates the plugin object.
the new plugin instance
Create and return a new plugin instance.
Initializes a new instance of the class
with the specified type.
The type name of plugin to create.
Create the attribute with the plugin type specified.
Where possible use the constructor that takes a .
Initializes a new instance of the class
with the specified type.
The type of plugin to create.
Create the attribute with the plugin type specified.
Creates the plugin object defined by this attribute.
Creates the instance of the object as
specified by this attribute.
The plugin object.
Returns a representation of the properties of this object.
Overrides base class method to
return a representation of the properties of this object.
A representation of the properties of this object
Gets or sets the type for the plugin.
The type for the plugin.
The type for the plugin.
Gets or sets the type name for the plugin.
The type name for the plugin.
The type name for the plugin.
Where possible use the property instead.
Assembly level attribute to configure the .
This attribute may only be used at the assembly scope and can only
be used once per assembly.
Use this attribute to configure the
without calling one of the
methods.
Nicko Cadell
Construct provider attribute with type specified
the type of the provider to use
The provider specified must subclass the
class.
Configures the SecurityContextProvider
The assembly that this attribute was defined on.
The repository to configure.
Creates a provider instance from the specified.
Sets this as the default security context provider .
Gets or sets the type of the provider to use.
the type of the provider to use.
The provider specified must subclass the
class.
Use this class to initialize the log4net environment using an Xml tree.
Configures a using an Xml tree.
Nicko Cadell
Gert Driesen
Private constructor
Automatically configures the log4net system based on the
application's configuration settings.
Each application has a configuration file. This has the
same name as the application with '.config' appended.
This file is XML and calling this function prompts the
configurator to look in that file for a section called
log4net that contains the configuration data.
To use this method to configure log4net you must specify
the section
handler for the log4net configuration section. See the
for an example.
Automatically configures the using settings
stored in the application's configuration file.
Each application has a configuration file. This has the
same name as the application with '.config' appended.
This file is XML and calling this function prompts the
configurator to look in that file for a section called
log4net that contains the configuration data.
To use this method to configure log4net you must specify
the section
handler for the log4net configuration section. See the
for an example.
The repository to configure.
Configures log4net using a log4net element
Loads the log4net configuration from the XML element
supplied as .
The element to parse.
Configures the using the specified XML
element.
Loads the log4net configuration from the XML element
supplied as .
The repository to configure.
The element to parse.
Configures log4net using the specified configuration file.
The XML file to load the configuration from.
The configuration file must be valid XML. It must contain
at least one element called log4net that holds
the log4net configuration data.
The log4net configuration file can possible be specified in the application's
configuration file (either MyAppName.exe.config for a
normal application on Web.config for an ASP.NET application).
The first element matching <configuration> will be read as the
configuration. If this file is also a .NET .config file then you must specify
a configuration section for the log4net element otherwise .NET will
complain. Set the type for the section handler to , for example:
The following example configures log4net using a configuration file, of which the
location is stored in the application's configuration file :
using log4net.Config;
using System.IO;
using System.Configuration;
...
XmlConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"]));
In the .config file, the path to the log4net can be specified like this :
Configures log4net using the specified configuration URI.
A URI to load the XML configuration from.
The configuration data must be valid XML. It must contain
at least one element called log4net that holds
the log4net configuration data.
The must support the URI scheme specified.
Configures log4net using the specified configuration data stream.
A stream to load the XML configuration from.
The configuration data must be valid XML. It must contain
at least one element called log4net that holds
the log4net configuration data.
Note that this method will NOT close the stream parameter.
Configures the using the specified configuration
file.
The repository to configure.
The XML file to load the configuration from.
The configuration file must be valid XML. It must contain
at least one element called log4net that holds
the configuration data.
The log4net configuration file can possible be specified in the application's
configuration file (either MyAppName.exe.config for a
normal application on Web.config for an ASP.NET application).
The first element matching <configuration> will be read as the
configuration. If this file is also a .NET .config file then you must specify
a configuration section for the log4net element otherwise .NET will
complain. Set the type for the section handler to , for example:
The following example configures log4net using a configuration file, of which the
location is stored in the application's configuration file :
using log4net.Config;
using System.IO;
using System.Configuration;
...
XmlConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["log4net-config-file"]));
In the .config file, the path to the log4net can be specified like this :
Configures the using the specified configuration
URI.
The repository to configure.
A URI to load the XML configuration from.
The configuration data must be valid XML. It must contain
at least one element called log4net that holds
the configuration data.
The must support the URI scheme specified.
Configures the using the specified configuration
file.
The repository to configure.
The stream to load the XML configuration from.
The configuration data must be valid XML. It must contain
at least one element called log4net that holds
the configuration data.
Note that this method will NOT close the stream parameter.
Configures log4net using the file specified, monitors the file for changes
and reloads the configuration if a change is detected.
The XML file to load the configuration from.
The configuration file must be valid XML. It must contain
at least one element called log4net that holds
the configuration data.
The configuration file will be monitored using a
and depends on the behavior of that class.
For more information on how to configure log4net using
a separate configuration file, see .
Configures the using the file specified,
monitors the file for changes and reloads the configuration if a change
is detected.
The repository to configure.
The XML file to load the configuration from.
The configuration file must be valid XML. It must contain
at least one element called log4net that holds
the configuration data.
The configuration file will be monitored using a
and depends on the behavior of that class.
For more information on how to configure log4net using
a separate configuration file, see .
Configures the specified repository using a log4net element.
The hierarchy to configure.
The element to parse.
Loads the log4net configuration from the XML element
supplied as .
This method is ultimately called by one of the Configure methods
to load the configuration from an .
Class used to watch config files.
Uses the to monitor
changes to a specified file. Because multiple change notifications
may be raised when the file is modified, a timer is used to
compress the notifications into a single event. The timer
waits for time before delivering
the event notification. If any further
change notifications arrive while the timer is waiting it
is reset and waits again for to
elapse.
The default amount of time to wait after receiving notification
before reloading the config file.
Watch a specified config file used to configure a repository
The repository to configure.
The configuration file to watch.
Watch a specified config file used to configure a repository
Holds the FileInfo used to configure the XmlConfigurator
Holds the repository being configured.
The timer used to compress the notification events.
Initializes a new instance of the class.
The repository to configure.
The configuration file to watch.
Initializes a new instance of the class.
Event handler used by .
The firing the event.
The argument indicates the file that caused the event to be fired.
This handler reloads the configuration from the file when the event is fired.
Event handler used by .
The firing the event.
The argument indicates the file that caused the event to be fired.
This handler reloads the configuration from the file when the event is fired.
Called by the timer when the configuration has been updated.
null
The implementation of the interface suitable
for use with the compact framework
This implementation is a simple
mapping between repository name and
object.
The .NET Compact Framework 1.0 does not support retrieving assembly
level attributes therefore unlike the DefaultRepositorySelector
this selector does not examine the calling assembly for attributes.
Nicko Cadell
Interface used by the to select the .
The uses a
to specify the policy for selecting the correct
to return to the caller.
Nicko Cadell
Gert Driesen
Gets the for the specified assembly.
The assembly to use to lookup to the
The for the assembly.
Gets the for the specified assembly.
How the association between and
is made is not defined. The implementation may choose any method for
this association. The results of this method must be repeatable, i.e.
when called again with the same arguments the result must be the
save value.
Gets the named .
The name to use to lookup to the .
The named
Lookup a named . This is the repository created by
calling .
Creates a new repository for the assembly specified.
The assembly to use to create the domain to associate with the .
The type of repository to create, must implement .
The repository created.
The created will be associated with the domain
specified such that a call to with the
same assembly specified will return the same repository instance.
How the association between and
is made is not defined. The implementation may choose any method for
this association.
Creates a new repository with the name specified.
The name to associate with the .
The type of repository to create, must implement .
The repository created.
The created will be associated with the name
specified such that a call to with the
same name will return the same repository instance.
Test if a named repository exists
the named repository to check
true if the repository exists
Test if a named repository exists. Use
to create a new repository and to retrieve
a repository.
Gets an array of all currently defined repositories.
An array of the instances created by
this .
Gets an array of all of the repositories created by this selector.
Event to notify that a logger repository has been created.
Event to notify that a logger repository has been created.
Event raised when a new repository is created.
The event source will be this selector. The event args will
be a which
holds the newly created .
Create a new repository selector
the type of the repositories to create, must implement
Create an new compact repository selector.
The default type for repositories must be specified,
an appropriate value would be .
throw if is null
throw if does not implement
Get the for the specified assembly
not used
The default
The argument is not used. This selector does not create a
separate repository for each assembly.
As a named repository is not specified the default repository is
returned. The default repository is named log4net-default-repository.
Get the named
the name of the repository to lookup
The named
Get the named . The default
repository is log4net-default-repository. Other repositories
must be created using the .
If the named repository does not exist an exception is thrown.
throw if is null
throw if the does not exist
Create a new repository for the assembly specified
not used
the type of repository to create, must implement
the repository created
The argument is not used. This selector does not create a
separate repository for each assembly.
If the is null then the
default repository type specified to the constructor is used.
As a named repository is not specified the default repository is
returned. The default repository is named log4net-default-repository.
Create a new repository for the repository specified
the repository to associate with the
the type of repository to create, must implement .
If this param is null then the default repository type is used.
the repository created
The created will be associated with the repository
specified such that a call to with the
same repository specified will return the same repository instance.
If the named repository already exists an exception will be thrown.
If is null then the default
repository type specified to the constructor is used.
throw if is null
throw if the already exists
Test if a named repository exists
the named repository to check
true if the repository exists
Test if a named repository exists. Use
to create a new repository and to retrieve
a repository.
Gets a list of objects
an array of all known objects
Gets an array of all of the repositories created by this selector.
Notify the registered listeners that the repository has been created
The repository that has been created
Raises the LoggerRepositoryCreatedEvent
event.
Event to notify that a logger repository has been created.
Event to notify that a logger repository has been created.
Event raised when a new repository is created.
The event source will be this selector. The event args will
be a which
holds the newly created .
The default implementation of the interface.
Uses attributes defined on the calling assembly to determine how to
configure the hierarchy for the repository.
Nicko Cadell
Gert Driesen
Creates a new repository selector.
The type of the repositories to create, must implement
Create an new repository selector.
The default type for repositories must be specified,
an appropriate value would be .
is .
does not implement .
Gets the for the specified assembly.
The assembly use to lookup the .
The type of the created and the repository
to create can be overridden by specifying the
attribute on the .
The default values are to use the
implementation of the interface and to use the
as the name of the repository.
The created will be automatically configured using
any attributes defined on
the .
The for the assembly
is .
Gets the for the specified repository.
The repository to use to lookup the .
The for the specified repository.
Returns the named repository. If is null
a is thrown. If the repository
does not exist a is thrown.
Use to create a repository.
is .
does not exist.
Create a new repository for the assembly specified
the assembly to use to create the repository to associate with the .
The type of repository to create, must implement .
The repository created.
The created will be associated with the repository
specified such that a call to with the
same assembly specified will return the same repository instance.
The type of the created and
the repository to create can be overridden by specifying the
attribute on the
. The default values are to use the
implementation of the
interface and to use the
as the name of the repository.
The created will be automatically
configured using any
attributes defined on the .
If a repository for the already exists
that repository will be returned. An error will not be raised and that
repository may be of a different type to that specified in .
Also the attribute on the
assembly may be used to override the repository type specified in
.
is .
Creates a new repository for the assembly specified.
the assembly to use to create the repository to associate with the .
The type of repository to create, must implement .
The name to assign to the created repository
Set to true to read and apply the assembly attributes
The repository created.
The created will be associated with the repository
specified such that a call to with the
same assembly specified will return the same repository instance.
The type of the created and
the repository to create can be overridden by specifying the
attribute on the
. The default values are to use the
implementation of the
interface and to use the
as the name of the repository.
The created will be automatically
configured using any
attributes defined on the .
If a repository for the already exists
that repository will be returned. An error will not be raised and that
repository may be of a different type to that specified in .
Also the attribute on the
assembly may be used to override the repository type specified in
.
is .
Creates a new repository for the specified repository.
The repository to associate with the .
The type of repository to create, must implement .
If this param is then the default repository type is used.
The new repository.
The created will be associated with the repository
specified such that a call to with the
same repository specified will return the same repository instance.
is .
already exists.
Test if a named repository exists
the named repository to check
true if the repository exists
Test if a named repository exists. Use
to create a new repository and to retrieve
a repository.
Gets a list of objects
an array of all known objects
Gets an array of all of the repositories created by this selector.
Aliases a repository to an existing repository.
The repository to alias.
The repository that the repository is aliased to.
The repository specified will be aliased to the repository when created.
The repository must not already exist.
When the repository is created it must utilize the same repository type as
the repository it is aliased to, otherwise the aliasing will fail.
is .
-or-
is .
Notifies the registered listeners that the repository has been created.
The repository that has been created.
Raises the event.
Gets the repository name and repository type for the specified assembly.
The assembly that has a .
in/out param to hold the repository name to use for the assembly, caller should set this to the default value before calling.
in/out param to hold the type of the repository to create for the assembly, caller should set this to the default value before calling.
is .
Configures the repository using information from the assembly.
The assembly containing
attributes which define the configuration for the repository.
The repository to configure.
is .
-or-
is .
Loads the attribute defined plugins on the assembly.
The assembly that contains the attributes.
The repository to add the plugins to.
is .
-or-
is .
Loads the attribute defined aliases on the assembly.
The assembly that contains the attributes.
The repository to alias to.
is .
-or-
is .
Event to notify that a logger repository has been created.
Event to notify that a logger repository has been created.
Event raised when a new repository is created.
The event source will be this selector. The event args will
be a which
holds the newly created .
Defined error codes that can be passed to the method.
Values passed to the method.
Nicko Cadell
A general error
Error while writing output
Failed to flush file
Failed to close file
Unable to open output file
No layout specified
Failed to parse address
Appenders may delegate their error handling to an .
Error handling is a particularly tedious to get right because by
definition errors are hard to predict and to reproduce.
Nicko Cadell
Gert Driesen
Handles the error and information about the error condition is passed as
a parameter.
The message associated with the error.
The that was thrown when the error occurred.
The error code associated with the error.
Handles the error and information about the error condition is passed as
a parameter.
Prints the error message passed as a parameter.
The message associated with the error.
The that was thrown when the error occurred.
See .
Prints the error message passed as a parameter.
The message associated with the error.
See .
Interface for objects that require fixing.
Interface that indicates that the object requires fixing before it
can be taken outside the context of the appender's
method.
When objects that implement this interface are stored
in the context properties maps
and
are fixed
(see ) the
method will be called.
Nicko Cadell
Get a portable version of this object
the portable instance of this object
Get a portable instance object that represents the current
state of this object. The portable object can be stored
and logged from any thread with identical results.
Interface that all loggers implement
This interface supports logging events and testing if a level
is enabled for logging.
These methods will not throw exceptions. Note to implementor, ensure
that the implementation of these methods cannot allow an exception
to be thrown to the caller.
Nicko Cadell
Gert Driesen
This generic form is intended to be used by wrappers.
The declaring type of the method that is
the stack boundary into the logging system for this call.
The level of the message to be logged.
The message object to log.
the exception to log, including its stack trace. Pass null to not log an exception.
Generates a logging event for the specified using
the and .
This is the most generic printing method that is intended to be used
by wrappers.
The event being logged.
Logs the specified logging event through this logger.
Checks if this logger is enabled for a given passed as parameter.
The level to check.
true if this logger is enabled for level, otherwise false.
Test if this logger is going to log events of the specified .
Gets the name of the logger.
The name of the logger.
The name of this logger
Gets the where this
Logger instance is attached to.
The that this logger belongs to.
Gets the where this
Logger instance is attached to.
Base interface for all wrappers
Base interface for all wrappers.
All wrappers must implement this interface.
Nicko Cadell
Get the implementation behind this wrapper object.
The object that in implementing this object.
The object that in implementing this
object. The Logger object may not
be the same object as this object because of logger decorators.
This gets the actual underlying objects that is used to process
the log events.
Delegate used to handle logger repository creation event notifications
The which created the repository.
The event args
that holds the instance that has been created.
Delegate used to handle logger repository creation event notifications.
Provides data for the event.
A
event is raised every time a is created.
The created
Construct instance using specified
the that has been created
Construct instance using specified
The that has been created
The that has been created
The that has been created
Test if an triggers an action
Implementations of this interface allow certain appenders to decide
when to perform an appender specific action.
The action or behavior triggered is defined by the implementation.
Nicko Cadell
Test if this event triggers the action
The event to check
true if this event triggers the action, otherwise false
Return true if this event triggers the action
Defines the default set of levels recognized by the system.
Each has an associated .
Levels have a numeric that defines the relative
ordering between levels. Two Levels with the same
are deemed to be equivalent.
The levels that are recognized by log4net are set for each
and each repository can have different levels defined. The levels are stored
in the on the repository. Levels are
looked up by name from the .
When logging at level INFO the actual level used is not but
the value of LoggerRepository.LevelMap["INFO"]. The default value for this is
, but this can be changed by reconfiguring the level map.
Each level has a in addition to its . The
is the string that is written into the output log. By default
the display name is the same as the level name, but this can be used to alias levels
or to localize the log output.
Some of the predefined levels recognized by the system are:
-
.
-
.
-
.
-
.
-
.
-
.
-
.
Nicko Cadell
Gert Driesen
Constructor
Integer value for this level, higher values represent more severe levels.
The string name of this level.
The display name for this level. This may be localized or otherwise different from the name
Initializes a new instance of the class with
the specified level name and value.
Constructor
Integer value for this level, higher values represent more severe levels.
The string name of this level.
Initializes a new instance of the class with
the specified level name and value.
Returns the representation of the current
.
A representation of the current .
Returns the level .
Compares levels.
The object to compare against.
true if the objects are equal.
Compares the levels of instances, and
defers to base class if the target object is not a
instance.
Returns a hash code
A hash code for the current .
Returns a hash code suitable for use in hashing algorithms and data
structures like a hash table.
Returns the hash code of the level .
Compares this instance to a specified object and returns an
indication of their relative values.
A instance or to compare with this instance.
A 32-bit signed integer that indicates the relative order of the
values compared. The return value has these meanings:
Value
Meaning
-
Less than zero
This instance is less than .
-
Zero
This instance is equal to .
-
Greater than zero
This instance is greater than .
-or-
is .
must be an instance of
or ; otherwise, an exception is thrown.
is not a .
Returns a value indicating whether a specified
is greater than another specified .
A
A
true if is greater than
; otherwise, false.
Compares two levels.
Returns a value indicating whether a specified
is less than another specified .
A
A
true if is less than
; otherwise, false.
Compares two levels.
Returns a value indicating whether a specified
is greater than or equal to another specified .
A
A
true if is greater than or equal to
; otherwise, false.
Compares two levels.
Returns a value indicating whether a specified
is less than or equal to another specified .
A
A
true if is less than or equal to
; otherwise, false.
Compares two levels.
Returns a value indicating whether two specified
objects have the same value.
A or .
A or .
true if the value of is the same as the
value of ; otherwise, false.
Compares two levels.
Returns a value indicating whether two specified
objects have different values.
A or .
A or .
true if the value of is different from
the value of ; otherwise, false.
Compares two levels.
Compares two specified instances.
The first to compare.
The second to compare.
A 32-bit signed integer that indicates the relative order of the
two values compared. The return value has these meanings:
Value
Meaning
-
Less than zero
is less than .
-
Zero
is equal to .
-
Greater than zero
is greater than .
Compares two levels.
The level designates a higher level than all the rest.
The level designates very severe error events.
System unusable, emergencies.
The level designates very severe error events
that will presumably lead the application to abort.
The level designates very severe error events.
Take immediate action, alerts.
The level designates very severe error events.
Critical condition, critical.
The level designates very severe error events.
The level designates error events that might
still allow the application to continue running.
The level designates potentially harmful
situations.
The level designates informational messages
that highlight the progress of the application at the highest level.
The level designates informational messages that
highlight the progress of the application at coarse-grained level.
The level designates fine-grained informational
events that are most useful to debug an application.
The level designates fine-grained informational
events that are most useful to debug an application.
The level designates fine-grained informational
events that are most useful to debug an application.
The level designates fine-grained informational
events that are most useful to debug an application.
The level designates fine-grained informational
events that are most useful to debug an application.
The level designates fine-grained informational
events that are most useful to debug an application.
The level designates the lowest level possible.
Gets the name of this level.
The name of this level.
Gets the name of this level.
Gets the value of this level.
The value of this level.
Gets the value of this level.
Gets the display name of this level.
The display name of this level.
Gets the display name of this level.
A strongly-typed collection of objects.
Nicko Cadell
Creates a read-only wrapper for a LevelCollection instance.
list to create a readonly wrapper arround
A LevelCollection wrapper that is read-only.
Initializes a new instance of the LevelCollection class
that is empty and has the default initial capacity.
Initializes a new instance of the LevelCollection class
that has the specified initial capacity.
The number of elements that the new LevelCollection is initially capable of storing.
Initializes a new instance of the LevelCollection class
that contains elements copied from the specified LevelCollection.
The LevelCollection whose elements are copied to the new collection.
Initializes a new instance of the LevelCollection class
that contains elements copied from the specified array.
The array whose elements are copied to the new list.
Initializes a new instance of the LevelCollection class
that contains elements copied from the specified collection.
The collection whose elements are copied to the new list.
Allow subclasses to avoid our default constructors
Copies the entire LevelCollection to a one-dimensional
array.
The one-dimensional array to copy to.
Copies the entire LevelCollection to a one-dimensional
array, starting at the specified index of the target array.
The one-dimensional array to copy to.
The zero-based index in at which copying begins.
Adds a to the end of the LevelCollection.
The to be added to the end of the LevelCollection.
The index at which the value has been added.
Removes all elements from the LevelCollection.
Creates a shallow copy of the .
A new with a shallow copy of the collection data.
Determines whether a given is in the LevelCollection.
The to check for.
true if is found in the LevelCollection; otherwise, false.
Returns the zero-based index of the first occurrence of a
in the LevelCollection.
The to locate in the LevelCollection.
The zero-based index of the first occurrence of
in the entire LevelCollection, if found; otherwise, -1.
Inserts an element into the LevelCollection at the specified index.
The zero-based index at which should be inserted.
The to insert.
is less than zero
-or-
is equal to or greater than .
Removes the first occurrence of a specific from the LevelCollection.
The to remove from the LevelCollection.
The specified was not found in the LevelCollection.
Removes the element at the specified index of the LevelCollection.
The zero-based index of the element to remove.
is less than zero
-or-
is equal to or greater than .
Returns an enumerator that can iterate through the LevelCollection.
An for the entire LevelCollection.
Adds the elements of another LevelCollection to the current LevelCollection.
The LevelCollection whose elements should be added to the end of the current LevelCollection.
The new of the LevelCollection.
Adds the elements of a array to the current LevelCollection.
The array whose elements should be added to the end of the LevelCollection.
The new of the LevelCollection.
Adds the elements of a collection to the current LevelCollection.
The collection whose elements should be added to the end of the LevelCollection.
The new of the LevelCollection.
Sets the capacity to the actual number of elements.
is less than zero
-or-
is equal to or greater than .
is less than zero
-or-
is equal to or greater than .
Gets the number of elements actually contained in the LevelCollection.
Gets a value indicating whether access to the collection is synchronized (thread-safe).
true if access to the ICollection is synchronized (thread-safe); otherwise, false.
Gets an object that can be used to synchronize access to the collection.
Gets or sets the at the specified index.
The zero-based index of the element to get or set.
is less than zero
-or-
is equal to or greater than .
Gets a value indicating whether the collection has a fixed size.
true if the collection has a fixed size; otherwise, false. The default is false
Gets a value indicating whether the IList is read-only.
true if the collection is read-only; otherwise, false. The default is false
Gets or sets the number of elements the LevelCollection can contain.
Supports type-safe iteration over a .
Advances the enumerator to the next element in the collection.
true if the enumerator was successfully advanced to the next element;
false if the enumerator has passed the end of the collection.
The collection was modified after the enumerator was created.
Sets the enumerator to its initial position, before the first element in the collection.
Gets the current element in the collection.
Type visible only to our subclasses
Used to access protected constructor
A value
Supports simple iteration over a .
Initializes a new instance of the Enumerator class.
Advances the enumerator to the next element in the collection.
true if the enumerator was successfully advanced to the next element;
false if the enumerator has passed the end of the collection.
The collection was modified after the enumerator was created.
Sets the enumerator to its initial position, before the first element in the collection.
Gets the current element in the collection.
An evaluator that triggers at a threshold level
This evaluator will trigger if the level of the event
passed to
is equal to or greater than the
level.
Nicko Cadell
The threshold for triggering
Create a new evaluator using the threshold.
Create a new evaluator using the threshold.
This evaluator will trigger if the level of the event
passed to
is equal to or greater than the
level.
Create a new evaluator using the specified threshold.
the threshold to trigger at
Create a new evaluator using the specified threshold.
This evaluator will trigger if the level of the event
passed to
is equal to or greater than the
level.
Is this the triggering event?