diff --git a/lib/log4Net/log4net.dll b/lib/log4Net/log4net.dll index ffc57e1..6385e8e 100644 Binary files a/lib/log4Net/log4net.dll and b/lib/log4Net/log4net.dll differ diff --git a/lib/log4Net/log4net.pdb b/lib/log4Net/log4net.pdb new file mode 100644 index 0000000..b186158 Binary files /dev/null and b/lib/log4Net/log4net.pdb differ diff --git a/lib/log4Net/log4net.xml b/lib/log4Net/log4net.xml index fab7af2..609cae0 100644 --- a/lib/log4Net/log4net.xml +++ b/lib/log4Net/log4net.xml @@ -109,7 +109,7 @@ the underlying database in one go. - Subclasses should override the + Subclasses should override the method to deliver the buffered events. The BufferingAppenderSkeleton maintains a fixed size cyclic @@ -119,14 +119,14 @@ 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 + (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 . + 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. @@ -152,7 +152,7 @@ Appenders can also implement the interface. Therefore - they would require that the method + they would require that the method be called after the appenders properties have been configured. @@ -170,7 +170,7 @@ Appenders can also implement the interface. Therefore - they would require that the method + they would require that the method be called after the appenders properties have been configured. @@ -340,13 +340,13 @@ Performs threshold checks and invokes filters before delegating actual logging to the subclasses specific - method. + method. The event to log. This method cannot be overridden by derived classes. A - derived class should override the method + derived class should override the method which is called by this method. @@ -368,14 +368,14 @@ - Calls and checks that + Calls and checks that it returns true. If all of the above steps succeed then the - will be passed to the abstract method. + will be passed to the abstract method. @@ -383,13 +383,13 @@ Performs threshold checks and invokes filters before delegating actual logging to the subclasses specific - method. + method. The array of events to log. This method cannot be overridden by derived classes. A - derived class should override the method + derived class should override the method which is called by this method. @@ -399,26 +399,26 @@ - Checks that the severity of the + 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 + Calls and checks that it returns true. If all of the above steps succeed then the - will be passed to the method. + will be passed to the method. @@ -521,12 +521,12 @@ A subclass must implement this method to perform logging of the . - This method will be called by + 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. + override the method. @@ -537,34 +537,34 @@ the array of logging events - This base class implementation calls the + 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 . + override this method in addition to . - Called before as a precondition. + Called before as a precondition. - This method is called by - before the call to the abstract method. + 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. + 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. + true if the call to should proceed. @@ -585,7 +585,7 @@ 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. @@ -610,9 +610,9 @@ will append the exception text to the rendered string. - Use this method in preference to + Use this method in preference to where possible. If, however, the caller needs to render the event - to a string then does + to a string then does provide an efficient mechanism for doing so. @@ -698,6 +698,15 @@ StringWriter used to render events + + + The fully qualified type of the AppenderSkeleton class. + + + Used by the internal logger to record the Type of the + log message. + + Gets or sets the threshold of this appender. @@ -775,7 +784,7 @@ then the appender should return true. - This default implementation always returns true. + This default implementation always returns false. @@ -887,7 +896,7 @@ - This method is called by the method. + This method is called by the method. the event to log @@ -911,7 +920,7 @@ Before the event is stored in the buffer it is fixed - (see ) to ensure that + (see ) to ensure that any data referenced by the event will be valid when the buffer is processed. @@ -925,7 +934,7 @@ The buffer containing the events that need to be send. - The subclass must override . + The subclass must override . @@ -1059,7 +1068,7 @@ 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 ). + immediately be sent (see ). If is set to true then an must be specified. @@ -1076,7 +1085,7 @@ 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 ). + be sent (see ). @@ -1095,7 +1104,7 @@ event data to be fixed and serialized. This will improve performance. - See for more information. + See for more information. @@ -1201,10 +1210,27 @@ Text that can be passed to a . - + - Connects to the database. - + Creates an instance used to connect to the database. + + + This method is called whenever a new IDbConnection is needed (i.e. when a reconnect is necessary). + + The of the object. + The connectionString output from the ResolveConnectionString method. + An instance with a valid connection string. + + + + Resolves the connection string from the ConnectionString, ConnectionStringName, or AppSettingsKey + property. + + + ConnectiongStringName is only supported on .NET 2.0 and higher. + + Additional information describing the connection string. + A connection string used to connect to the database. @@ -1223,20 +1249,17 @@ The of the ADO.NET provider - + - Prepares the database command and initialize the parameters. - + Connects to the database. + - + - Flag to indicate if we are using a command object + Cleanup the existing connection. - - Set to true when the appender is to use a prepared - statement or stored procedure to insert into the database. - + Calls the IDbConnection's method. @@ -1260,14 +1283,19 @@ to insert logging events into a database. - + - The database command. + Database connection string. - + - Database connection string. + The appSettings key from App.Config that contains the connection string. + + + + + The connectionStrings key from App.Config that contains the connection string. @@ -1292,8 +1320,17 @@ - Indicates whether to use transactions when writing to the database. + Indicates whether to reconnect when a connection is lost. + + + + + The fully qualified type of the AdoNetAppender class. + + Used by the internal logger to record the Type of the + log message. + @@ -1319,6 +1356,19 @@ "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Work\cvs_root\log4net-1.2\access.mdb;User Id=;Password=;" + + + The appSettings key from App.Config that contains the connection string. + + + + + The connectionStrings key from App.Config that contains the connection string. + + + This property requires at least .NET 2.0. + + Gets or sets the type name of the connection @@ -1372,6 +1422,10 @@ The property determines if this text is a prepared statement or a stored procedure. + + If this property is not set, the command text is retrieved by invoking + . + @@ -1641,6 +1695,9 @@ This property is optional. If not specified the ADO.NET provider will attempt to infer the size from the value. + + For BLOB data types like VARCHAR(max) it may be impossible to infer the value automatically, use -1 as the size in this case. + @@ -1795,7 +1852,7 @@ - This method is called by the method. + This method is called by the method. The event to log. @@ -1903,6 +1960,11 @@ text is displayed with a strikethrough + + + text color is light + + The enum of possible foreground or background color values for @@ -2248,16 +2310,16 @@ - is less than zero + is less than zero -or- - is equal to or greater than . + is equal to or greater than . - is less than zero + is less than zero -or- - is equal to or greater than . + is equal to or greater than . @@ -2399,12 +2461,14 @@ 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. + The logging event is passed to the or + method depending on the level of the logging event. + The event's logger name is the default value for the category parameter of the Write/Warn method. Nicko Cadell Gert Driesen + Ron Grabowski @@ -2429,6 +2493,11 @@ + + + Defaults to %logger + + This appender requires a to be set. @@ -2440,6 +2509,19 @@ + + + The category parameter sent to the Trace method. + + + + Defaults to %logger which will use the logger name of the current + as the category parameter. + + + + + Buffers events and then forwards them to attached appenders. @@ -2797,7 +2879,7 @@ - This method is called by the method. + This method is called by the method. The event to log. @@ -3052,7 +3134,7 @@ - This method is called by the method. + This method is called by the method. The event to log. @@ -3103,7 +3185,7 @@ debug system. - Events are written using the + Events are written using the method. The event's logger name is passed as the value for the category name to the Write method. @@ -3198,8 +3280,17 @@ + The appender will fail if you try to write using an event source that doesn't exist unless it is running with local administrator privileges. + See also http://logging.apache.org/log4net/release/faq.html#trouble-EventLog + + The EventID of the event log entry can be - set using the EventLogEventID property () + set using the EventID property () + on the . + + + The Category of the event log entry can be + set using the Category property () on the . @@ -3297,7 +3388,7 @@ - This method is called by the + This method is called by the method. the event to log @@ -3315,10 +3406,10 @@ - Get the equivalent for a + Get the equivalent for a the Level to convert to an EventLogEntryType - The equivalent for a + The equivalent for a Because there are fewer applicable values to use in logging levels than there are in the @@ -3354,6 +3445,88 @@ The security context to use for privileged calls + + + The event ID to use unless one is explicitly specified via the LoggingEvent's properties. + + + + + The event category to use unless one is explicitly specified via the LoggingEvent's properties. + + + + + The fully qualified type of the EventLogAppender class. + + + Used by the internal logger to record the Type of the + log message. + + + + + The maximum size supported by default. + + + http://msdn.microsoft.com/en-us/library/xzwc042w(v=vs.100).aspx + The 32766 documented max size is two bytes shy of 32K (I'm assuming 32766 + may leave space for a two byte null terminator of #0#0). The 32766 max + length is what the .NET 4.0 source code checks for, but this is WRONG! + Strings with a length > 31839 on Windows Vista or higher can CORRUPT + the event log! See: System.Diagnostics.EventLogInternal.InternalWriteEvent() + for the use of the 32766 max size. + + + + + The maximum size supported by a windows operating system that is vista + or newer. + + + See ReportEvent API: + http://msdn.microsoft.com/en-us/library/aa363679(VS.85).aspx + ReportEvent's lpStrings parameter: + "A pointer to a buffer containing an array of + null-terminated strings that are merged into the message before Event Viewer + displays the string to the user. This parameter must be a valid pointer + (or NULL), even if wNumStrings is zero. Each string is limited to 31,839 characters." + + Going beyond the size of 31839 will (at some point) corrupt the event log on Windows + Vista or higher! It may succeed for a while...but you will eventually run into the + error: "System.ComponentModel.Win32Exception : A device attached to the system is + not functioning", and the event log will then be corrupt (I was able to corrupt + an event log using a length of 31877 on Windows 7). + + The max size for Windows Vista or higher is documented here: + http://msdn.microsoft.com/en-us/library/xzwc042w(v=vs.100).aspx. + Going over this size may succeed a few times but the buffer will overrun and + eventually corrupt the log (based on testing). + + The maxEventMsgSize size is based on the max buffer size of the lpStrings parameter of the ReportEvent API. + The documented max size for EventLog.WriteEntry for Windows Vista and higher is 31839, but I'm leaving room for a + terminator of #0#0, as we cannot see the source of ReportEvent (though we could use an API monitor to examine the + buffer, given enough time). + + + + + The maximum size that the operating system supports for + a event log message. + + + Used to determine the maximum string length that can be written + to the operating system event log and eventually truncate a string + that exceeds the limits. + + + + + This method determines the maximum event log message size allowed for + the current environment. + + + The name of the log where messages will be stored. @@ -3420,6 +3593,32 @@ + + + Gets or sets the EventId to use unless one is explicitly specified via the LoggingEvent's properties. + + + + The EventID of the event log entry will normally be + set using the EventID property () + on the . + This property provides the fallback value which defaults to 0. + + + + + + Gets or sets the Category to use unless one is explicitly specified via the LoggingEvent's properties. + + + + The Category of the event log entry will normally be + set using the Category property () + on the . + This property provides the fallback value which defaults to 0. + + + This appender requires a to be set. @@ -3488,8 +3687,13 @@ 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. + The alternative models only hold a + write lock while the appender is writing a logging event () + or synchronize by using a named system wide Mutex (). + + + All locking strategies have issues and you should seriously consider using a different strategy that + avoids having multiple processes logging to the same file. Nicko Cadell @@ -3562,7 +3766,7 @@ - This method checked if an output target has been set and if a + This method checks if an output target has been set and if a layout has been set. @@ -3570,7 +3774,7 @@ - This method is called by the + This method is called by the method. The event to log. @@ -3586,7 +3790,7 @@ - This method is called by the + This method is called by the method. The array of events to log. @@ -3692,6 +3896,15 @@ + + + The fully qualified type of the TextWriterAppender class. + + + Used by the internal logger to record the Type of the + log message. + + Gets or set whether the appender will flush at the end @@ -3836,6 +4049,11 @@ + + + Close this appender instance. The underlying stream or writer is also closed. + + Called to initialize the file writer @@ -3849,7 +4067,7 @@ - This method is called by the + This method is called by the method. The event to log. @@ -3865,7 +4083,7 @@ - This method is called by the + This method is called by the method. The array of events to log. @@ -3954,9 +4172,9 @@ the file stream that has been opened for writing - This implementation of creates a + This implementation of creates a over the and passes it to the - method. + method. This method can be overridden by sub classes that want to wrap the @@ -4023,6 +4241,15 @@ The locking model to use + + + The fully qualified type of the FileAppender class. + + + Used by the internal logger to record the Type of the + log message. + + Gets or sets the path to the file that logging will be written to. @@ -4095,9 +4322,10 @@ 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. + There are three built in locking models, , and . + The first locks the file from the start of logging to the end, the + second locks only for the minimal amount of time when logging each message + and the last synchronizes processes using a named system wide Mutex. The default locking model is the . @@ -4213,6 +4441,16 @@ + + + Initializes all resources used by this locking model. + + + + + Disposes all resources that were initialized by this locking model. + + Acquire the lock on the file @@ -4237,6 +4475,33 @@ + + + Helper method that creates a FileStream under CurrentAppender's SecurityContext. + + + + Typically called during OpenFile or AcquireLock. + + + If the directory portion of the does not exist, it is created + via Directory.CreateDirecctory. + + + + + + + + + + Helper method to close under CurrentAppender's SecurityContext. + + + Does not set to null. + + + Gets or sets the for this LockingModel @@ -4316,6 +4581,16 @@ + + + Initializes all resources used by this locking model. + + + + + Disposes all resources that were initialized by this locking model. + + Acquires the file lock for each write @@ -4379,6 +4654,75 @@ + + + Initializes all resources used by this locking model. + + + + + Disposes all resources that were initialized by this locking model. + + + + + Provides cross-process file locking. + + Ron Grabowski + Steve Wranovsky + + + + 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 + + + + + + Releases the lock and allows others to acquire a lock. + + + + + Initializes all resources used by this locking model. + + + + + Disposes all resources that were initialized by this locking model. + + This appender forwards logging events to attached appenders. @@ -4592,7 +4936,7 @@ - This method is called by the method. + This method is called by the method. The event to log. @@ -4920,54 +5264,256 @@ - + - Stores logging events in an array. + Appends colorful logging events to the console, using the .NET 2 + built-in capabilities. - The memory appender stores all the logging events - that are appended in an in-memory array. + ManagedColoredConsoleAppender 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. - Use the method to get - the current list of events that have been appended. + When configuring the colored console appender, mappings should be + specified to map logging levels to colors. For example: + + + + + + + + + + + + + + + + + + + + + + The Level is the standard log4net logging level while + ForeColor and BackColor are the values of + enumeration. - Use the method to clear the - current list of events. + Based on the ColoredConsoleAppender - Julian Biddle + Rick Hobbs Nicko Cadell - Gert Driesen + Pavlos Touboulidis - + - Initializes a new instance of the class. + The to use when writing to the Console + standard output stream. - Default constructor. + The to use when writing to the Console + standard output stream. - + - Gets the events that have been logged. + The to use when writing to the Console + standard error output stream. - The events that have been logged - Gets the events that have been logged. + The to use when writing to the Console + standard error output stream. - + - This method is called by the method. + Initializes a new instance of the class. - the event to log + + The instance of the class is set up to write + 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 + + + + + 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. + + + + + + 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. + + + + + + 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. + + + + + + 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 + and clear the current list of events that have been appended. + + + Use the method to get the current + list of events that have been appended. Note there is a + race-condition when calling and + in pairs, you better use in that case. + + + Use the method to clear the + current list of events. Note there is a + race-condition when calling and + in pairs, you better use in that case. + + + 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. @@ -4980,6 +5526,17 @@ Clear the list of events + + + Gets the events that have been logged and clears the list of events. + + The events that have been logged + + + Gets the events that have been logged and clears the list of events. + + + The list of events that have been appended. @@ -5008,7 +5565,7 @@ data to be fixed and stored in the appender, hereby improving performance. - See for more information. + See for more information. @@ -5054,10 +5611,10 @@ Send a message to a user account on the local machine - = <name of the local machine> + = <name of the local machine> - = <user name> + = <user name> @@ -5065,10 +5622,10 @@ Send a message to a user account on a remote machine - = <name of the remote machine> + = <name of the remote machine> - = <user name> + = <user name> @@ -5076,10 +5633,10 @@ Send a message to a domain user account - = <name of a domain controller | uninitialized> + = <name of a domain controller | uninitialized> - = <user name> + = <user name> @@ -5087,7 +5644,7 @@ Send a message to all the names in a workgroup or domain - = <workgroup name | domain name>* + = <workgroup name | domain name>* @@ -5095,10 +5652,10 @@ Send a message from the local machine to a remote machine - = <name of the local machine | uninitialized> + = <name of the local machine | uninitialized> - = <name of the remote machine> + = <name of the remote machine> @@ -5179,7 +5736,7 @@ - This method is called by the method. + This method is called by the method. The event to log. @@ -5524,7 +6081,7 @@ - This method is called by the method. + This method is called by the method. The event to log. @@ -5756,6 +6313,16 @@ Syslog port 514 + + + Initial buffer size + + + + + Maximum buffer size before it is recycled + + Initializes a new instance of the class. @@ -5778,7 +6345,7 @@ - This method is called by the method. + This method is called by the method. The event to log. @@ -6359,6 +6926,20 @@ + + + Cleans up all resources used by this appender. + + + + + The fully qualified type of the RollingFileAppender class. + + + Used by the internal logger to record the Type of the + log message. + + Sets the quiet writer being used. @@ -6484,6 +7065,17 @@ + + + Attempts to extract a number from the end of the file name that indicates + the number of the times the file has been rolled over. + + + Certain date pattern extensions like yyyyMMdd will be parsed as valid backup indexes. + + + + Takes a list of files and a base file name, and looks for @@ -6531,6 +7123,14 @@ + + + + + + .1, .2, .3, etc. + + Rollover the file(s) to date/time tagged file(s). @@ -6661,7 +7261,8 @@ 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. + a method to control this class when testing date/time based rolling. The default + implementation uses the underlying value of DateTime.Now. @@ -6732,16 +7333,50 @@ Value indicating whether to always log to the same file. + + + Value indicating whether to preserve the file name extension when rolling. + + FileName provided in configuration. Used for rolling properly + + + A mutex that is used to lock rolling of files. + + The 1st of January 1970 in UTC + + + Gets or sets the strategy for determining the current date and time. The default + implementation is to use LocalDateTime which internally calls through to DateTime.Now. + DateTime.UtcNow may be used on frameworks newer than .NET 1.0 by specifying + . + + + An implementation of the interface which returns the current date and time. + + + + Gets or sets the used to return the current date and time. + + + There are two built strategies for determining the current date and time, + + and . + + + The default strategy is . + + + Gets or sets the date pattern to be used for generating file names @@ -6878,6 +7513,22 @@ + + + Gets or sets a value indicating whether to preserve the file name extension when rolling. + + + true if the file name extension should be preserved. + + + + By default file.log is rolled to file.log.yyyy-MM-dd or file.log.curSizeRollBackup. + However, under Windows the new file name will loose any program associations as the + extension is changed. Optionally file.log can be renamed to file.yyyy-MM-dd.log or + file.curSizeRollBackup.log to maintain any program associations. + + + Gets or sets a value indicating whether to always log to @@ -7007,12 +7658,28 @@ - + Default implementation of that returns the current time. - + + + Gets the current time. + + The current time. + + + Gets the current time. + + + + + + Implementation of that returns the current time as the coordinated universal time (UTC). + + + Gets the current time. @@ -7079,9 +7746,58 @@ the body text to include in the mail + + + trims leading and trailing commas or semicolons + + - Gets or sets a semicolon-delimited list of recipient e-mail addresses. + Gets or sets a comma- or semicolon-delimited list of recipient e-mail addresses (use semicolon on .NET 1.1 and comma for later versions). + + + + For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses. + + + For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses. + + + + + For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses. + + + For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses. + + + + + + Gets or sets a comma- or semicolon-delimited list of recipient e-mail addresses + that will be carbon copied (use semicolon on .NET 1.1 and comma for later versions). + + + + For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses. + + + For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses. + + + + + For .NET 1.1 (System.Web.Mail): A semicolon-delimited list of e-mail addresses. + + + For .NET 2.0 (System.Net.Mail): A comma-delimited list of e-mail addresses. + + + + + + Gets or sets a semicolon-delimited list of recipient e-mail addresses + that will be blind carbon copied. A semicolon-delimited list of e-mail addresses. @@ -7221,7 +7937,39 @@ - + + + Enable or disable use of SSL when sending e-mail message + + + This is available on MS .NET 2.0 runtime and higher + + + + + Gets or sets the reply-to e-mail address. + + + This is available on MS .NET 2.0 runtime and higher + + + + + Gets or sets the subject encoding to be used. + + + The default encoding is the operating system's current ANSI codepage. + + + + + Gets or sets the body encoding to be used. + + + The default encoding is the operating system's current ANSI codepage. + + + This appender requires a to be set. @@ -7397,6 +8145,19 @@ + + + Gets or sets the file extension for the generated files + + + The file extension for the generated files + + + + The file extension for the generated files + + + Gets or sets the used to write to the pickup directory. @@ -7453,6 +8214,15 @@ + + + The fully qualified type of the TelnetAppender class. + + + Used by the internal logger to record the Type of the + log message. + + Overrides the parent method to close the socket handler @@ -7660,7 +8430,8 @@ 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. + method. The event's logger name is the default value for the category parameter + of the Write method. Compact Framework
@@ -7673,6 +8444,7 @@ Douglas de la Torre Nicko Cadell Gert Driesen + Ron Grabowski @@ -7724,6 +8496,11 @@ The default value is true. + + + Defaults to %logger + + Gets or sets a value that indicates whether the appender will @@ -7744,6 +8521,19 @@ + + + The category parameter sent to the Trace method. + + + + Defaults to %logger which will use the logger name of the current + as the category parameter. + + + + + This appender requires a to be set. @@ -7853,13 +8643,22 @@ Appenders can also implement the interface. Therefore - they would require that the method + they would require that the method be called after the appenders properties have been configured. Nicko Cadell Gert Driesen + + + The fully qualified type of the BasicConfigurator class. + + + Used by the internal logger to record the Type of the + log message. + + Initializes a new instance of the class. @@ -7895,6 +8694,17 @@ + + + Initializes the log4net system using the specified appenders. + + The appenders to use to log all logging events. + + + Initializes the log4net system using the specified appenders. + + + Initializes the with a default configuration. @@ -7922,6 +8732,18 @@ + + + Initializes the using the specified appenders. + + The repository to configure. + The appenders to use to log all logging events. + + + Initializes the using the specified appender. + + + Base class for all log4net configuration attributes. @@ -8335,10 +9157,10 @@ For more information on how to configure log4net using - a separate configuration file, see . + a separate configuration file, see . - + @@ -8363,10 +9185,10 @@ For more information on how to configure log4net using - a separate configuration file, see . + a separate configuration file, see . - + @@ -8382,7 +9204,7 @@ Use this attribute to configure the - without calling one of the + without calling one of the methods. @@ -8400,7 +9222,7 @@ Use this attribute to configure the - without calling one of the + without calling one of the methods. @@ -8431,7 +9253,7 @@ 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. + call the method directly. @@ -8462,7 +9284,7 @@ configure it. - The does not extend . + The does not extend . @@ -8485,6 +9307,15 @@ The assembly that this attribute was defined on. The repository to configure. + + + The fully qualified type of the XmlConfiguratorAttribute class. + + + Used by the internal logger to record the Type of the + log message. + + Gets or sets the filename of the configuration file. @@ -8683,7 +9514,7 @@ - Overrides base class method to + Overrides base class method to return a representation of the properties of this object. @@ -8729,7 +9560,7 @@ Use this attribute to configure the - without calling one of the + without calling one of the methods. @@ -8760,6 +9591,15 @@ + + + The fully qualified type of the SecurityContextProviderAttribute class. + + + Used by the internal logger to record the Type of the + log message. + + Gets or sets the type of the provider to use. @@ -9051,10 +9891,10 @@ For more information on how to configure log4net using - a separate configuration file, see . + a separate configuration file, see . - + @@ -9076,12 +9916,12 @@ For more information on how to configure log4net using - a separate configuration file, see . + a separate configuration file, see . - + - + Configures the specified repository using a log4net element. @@ -9098,6 +9938,22 @@ + + + Maps repository names to ConfigAndWatchHandler instances to allow a particular + ConfigAndWatchHandler to dispose of its FileSystemWatcher when a repository is + reconfigured. + + + + + The fully qualified type of the XmlConfigurator class. + + + Used by the internal logger to record the Type of the + log message. + + Class used to watch config files. @@ -9122,18 +9978,6 @@ 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 @@ -9149,9 +9993,16 @@ The timer used to compress the notification events. + + + Watches file for changes. This object should be disposed when no longer + needed to free system handles on the watched resources. + + - Initializes a new instance of the class. + Initializes a new instance of the class to + watch a specified config file used to configure a repository. The repository to configure. The configuration file to watch. @@ -9191,6 +10042,11 @@ null + + + Release the handles held by the watcher and timer. + + The implementation of the interface suitable @@ -9251,7 +10107,7 @@ The named Lookup a named . This is the repository created by - calling . + calling . @@ -9264,7 +10120,7 @@ The created will be associated with the domain - specified such that a call to with the + specified such that a call to with the same assembly specified will return the same repository instance. @@ -9284,7 +10140,7 @@ The created will be associated with the name - specified such that a call to with the + specified such that a call to with the same name will return the same repository instance. @@ -9297,8 +10153,8 @@ true if the repository exists - Test if a named repository exists. Use - to create a new repository and to retrieve + Test if a named repository exists. Use + to create a new repository and to retrieve a repository. @@ -9374,7 +10230,7 @@ Get the named . The default repository is log4net-default-repository. Other repositories - must be created using the . + must be created using the . If the named repository does not exist an exception is thrown. @@ -9414,7 +10270,7 @@ The created will be associated with the repository - specified such that a call to with the + specified such that a call to with the same repository specified will return the same repository instance. @@ -9436,8 +10292,8 @@ true if the repository exists - Test if a named repository exists. Use - to create a new repository and to retrieve + Test if a named repository exists. Use + to create a new repository and to retrieve a repository. @@ -9453,6 +10309,15 @@ + + + The fully qualified type of the CompactRepositorySelector class. + + + Used by the internal logger to record the Type of the + log message. + + Notify the registered listeners that the repository has been created @@ -9547,7 +10412,7 @@ does not exist a is thrown. - Use to create a repository. + Use to create a repository. is . @@ -9563,7 +10428,7 @@ The created will be associated with the repository - specified such that a call to with the + specified such that a call to with the same assembly specified will return the same repository instance. @@ -9603,7 +10468,7 @@ The created will be associated with the repository - specified such that a call to with the + specified such that a call to with the same assembly specified will return the same repository instance. @@ -9642,7 +10507,7 @@ The created will be associated with the repository - specified such that a call to with the + specified such that a call to with the same repository specified will return the same repository instance. @@ -9657,8 +10522,8 @@ true if the repository exists - Test if a named repository exists. Use - to create a new repository and to retrieve + Test if a named repository exists. Use + to create a new repository and to retrieve a repository. @@ -9753,6 +10618,15 @@ is . + + + The fully qualified type of the DefaultRepositorySelector class. + + + Used by the internal logger to record the Type of the + log message. + + Event to notify that a logger repository has been created. @@ -9771,11 +10645,11 @@ - Defined error codes that can be passed to the method. + Defined error codes that can be passed to the method. - Values passed to the method. + Values passed to the method. Nicko Cadell @@ -9815,6 +10689,94 @@ Failed to parse address + + + An evaluator that triggers on an Exception type + + + + This evaluator will trigger if the type of the Exception + passed to + is equal to a Type in . /// + + + Drew Schaeffer + + + + 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 + + + + + + The type that causes the trigger to fire. + + + + + Causes subclasses of to cause the trigger to fire. + + + + + Default ctor to allow dynamic creation through a configurator. + + + + + Constructs an evaluator and initializes to trigger on + + the type that triggers this evaluator. + If true, this evaluator will trigger on subclasses of . + + + + Is this the triggering event? + + The event to check + This method returns true, if the logging event Exception + Type is . + Otherwise it returns false + + + This evaluator will trigger if the Exception Type of the event + passed to + is . + + + + + + The type that triggers this evaluator. + + + + + If true, this evaluator will trigger on subclasses of . + + Appenders may delegate their error handling to an . @@ -9851,7 +10813,7 @@ The that was thrown when the error occurred. - See . + See . @@ -9862,7 +10824,7 @@ The message associated with the error. - See . + See . @@ -10072,33 +11034,6 @@ - - - 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. @@ -10410,6 +11345,12 @@ 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. @@ -10717,16 +11658,16 @@ - is less than zero + is less than zero -or- - is equal to or greater than . + is equal to or greater than . - is less than zero + is less than zero -or- - is equal to or greater than . + is equal to or greater than . @@ -10851,7 +11792,7 @@ This evaluator will trigger if the level of the event - passed to + passed to is equal to or greater than the level. @@ -10873,7 +11814,7 @@ This evaluator will trigger if the level of the event - passed to + passed to is equal to or greater than the level. @@ -10890,7 +11831,7 @@ This evaluator will trigger if the level of the event - passed to + passed to is equal to or greater than the level. @@ -10907,7 +11848,7 @@ This evaluator will trigger if the level of the event - passed to + passed to is equal to or greater than the level. @@ -10923,7 +11864,7 @@ This evaluator will trigger if the level of the event - passed to + passed to is equal to or greater than the level. @@ -10979,7 +11920,7 @@ Create a new Level and add it to the map - + @@ -11118,6 +12059,15 @@ + + + The fully qualified type of the LocationInfo class. + + + Used by the internal logger to record the Type of the + log message. + + Gets the fully qualified class name of the caller making the logging @@ -11188,6 +12138,11 @@ + + + Gets the stack frames from the stack trace of the caller making the log request + + Static manager that controls the creation of repositories @@ -11396,7 +12351,7 @@ - Shorthand for . + Shorthand for . The repository to lookup in. The of which the fullname will be used as the name of the logger to retrieve. @@ -11409,7 +12364,7 @@ - Shorthand for . + Shorthand for . the assembly to use to lookup the repository The of which the fullname will be used as the name of the logger to retrieve. @@ -11612,7 +12567,7 @@ The created will be associated with the repository - specified such that a call to with the + specified such that a call to with the same assembly specified will return the same repository instance. @@ -11629,7 +12584,7 @@ The created will be associated with the repository - specified such that a call to with the + specified such that a call to with the same assembly specified will return the same repository instance. @@ -11662,7 +12617,7 @@ Called when the event fires. - When the event is triggered the log4net system is . + When the event is triggered the log4net system is . @@ -11677,10 +12632,19 @@ Called when the event fires. - When the event is triggered the log4net system is . + When the event is triggered the log4net system is . + + + The fully qualified type of the LoggerManager class. + + + Used by the internal logger to record the Type of the + log message. + + Initialize the default repository selector @@ -11702,7 +12666,7 @@ The caller to supplies either a string name or an assembly (if not supplied the assembly is inferred using - ). + ). This context is used by the selector to lookup a specific repository. @@ -11953,7 +12917,7 @@ - Fix the event properties + Fix the event properties. Active properties must implement in order to be eligible for fixing. @@ -12002,8 +12966,8 @@ time the event is delivered to appenders, but will not be consistent at any time afterwards. If an event is to be stored and then processed at a later time these volatile values must be fixed by calling - . There is a performance penalty - for incurred by calling but it + . There is a performance penalty + for incurred by calling but it is essential to maintaining data consistency. @@ -12043,7 +13007,7 @@ Except , and , all fields of LoggingEvent are filled when actually needed. Call - to cache all data locally + to cache all data locally to prevent inconsistencies. This method is called by the log4net framework @@ -12068,7 +13032,7 @@ be useful if you require a custom serialization scheme. - Use the method to obtain an + Use the method to obtain an instance of the class. @@ -12094,7 +13058,7 @@ be useful if you require a custom serialization scheme. - Use the method to obtain an + Use the method to obtain an instance of the class. @@ -12117,7 +13081,7 @@ be useful if you require a custom serialization scheme. - Use the method to obtain an + Use the method to obtain an instance of the class. @@ -12172,7 +13136,7 @@ The data in this event must be fixed before it can be serialized. - The method must be called during the + The method must be called during the method call if this event is to be used outside that method. @@ -12247,17 +13211,17 @@ time the event is delivered to appenders, but will not be consistent at any time afterwards. If an event is to be stored and then processed at a later time these volatile values must be fixed by calling - . There is a performance penalty - incurred by calling but it + . There is a performance penalty + incurred by calling but it is essential to maintaining data consistency. - Calling is equivalent to - calling passing the parameter + Calling is equivalent to + calling passing the parameter false. - See for more + See for more information. @@ -12274,8 +13238,8 @@ time the event is delivered to appenders, but will not be consistent at any time afterwards. If an event is to be stored and then processed at a later time these volatile values must be fixed by calling - . There is a performance penalty - for incurred by calling but it + . There is a performance penalty + for incurred by calling but it is essential to maintaining data consistency. @@ -12714,7 +13678,7 @@ DEBUG - The and methods log messages + The and methods log messages at the DEBUG level. That is the level with that name defined in the repositories . The default value for this level is . The @@ -12724,7 +13688,7 @@ INFO - The and methods log messages + The and methods log messages at the INFO level. That is the level with that name defined in the repositories . The default value for this level is . The @@ -12734,7 +13698,7 @@ WARN - The and methods log messages + The and methods log messages at the WARN level. That is the level with that name defined in the repositories . The default value for this level is . The @@ -12744,7 +13708,7 @@ ERROR - The and methods log messages + The and methods log messages at the ERROR level. That is the level with that name defined in the repositories . The default value for this level is . The @@ -12754,7 +13718,7 @@ FATAL - The and methods log messages + The and methods log messages at the FATAL level. That is the level with that name defined in the repositories . The default value for this level is . The @@ -12778,7 +13742,7 @@ Use the to obtain logger instances - that implement this interface. The + that implement this interface. The static method is used to get logger instances. @@ -12807,7 +13771,7 @@ - + Nicko Cadell Gert Driesen @@ -12832,10 +13796,10 @@ WARNING Note that passing an to this method will print the name of the but no stack trace. To print a stack trace use the - form instead. + form instead. - + @@ -12848,10 +13812,10 @@ The exception to log, including its stack trace. - See the form for more detailed information. + See the form for more detailed information. - + @@ -12864,16 +13828,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -12885,16 +13849,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -12907,16 +13871,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -12930,16 +13894,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -12952,16 +13916,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -12984,11 +13948,11 @@ WARNING Note that passing an to this method will print the name of the but no stack trace. To print a stack trace use the - form instead. + form instead. The message object to log. - + @@ -13001,10 +13965,10 @@ The exception to log, including its stack trace. - See the form for more detailed information. + See the form for more detailed information. - + @@ -13017,16 +13981,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13038,16 +14002,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13060,16 +14024,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13083,16 +14047,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13105,16 +14069,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13137,11 +14101,11 @@ WARNING Note that passing an to this method will print the name of the but no stack trace. To print a stack trace use the - form instead. + form instead. The message object to log. - + @@ -13154,10 +14118,10 @@ The exception to log, including its stack trace. - See the form for more detailed information. + See the form for more detailed information. - + @@ -13170,16 +14134,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13191,16 +14155,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13213,16 +14177,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13236,16 +14200,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13258,16 +14222,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13291,10 +14255,10 @@ WARNING Note that passing an to this method will print the name of the but no stack trace. To print a stack trace use the - form instead. + form instead. - + @@ -13307,10 +14271,10 @@ The exception to log, including its stack trace. - See the form for more detailed information. + See the form for more detailed information. - + @@ -13323,16 +14287,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13344,16 +14308,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13366,16 +14330,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13389,16 +14353,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13411,16 +14375,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13443,11 +14407,11 @@ WARNING Note that passing an to this method will print the name of the but no stack trace. To print a stack trace use the - form instead. + form instead. The message object to log. - + @@ -13460,10 +14424,10 @@ The exception to log, including its stack trace. - See the form for more detailed information. + See the form for more detailed information. - + @@ -13476,16 +14440,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13497,16 +14461,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13519,16 +14483,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13542,16 +14506,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13564,16 +14528,16 @@ The message is formatted using the String.Format method. See - for details of the syntax of the format string and the behavior + for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. - + @@ -13611,7 +14575,7 @@ the other hand, if the log is debug enabled, you will incur the cost of evaluating whether the logger is debug enabled twice. Once in and once in - the . This is an insignificant overhead + the . This is an insignificant overhead since evaluating a logger takes about 1% of the time it takes to actually log. This is the preferred style of logging. @@ -13644,8 +14608,8 @@ speed or runtime flexibility. - - + + @@ -13657,8 +14621,8 @@ For more information see . - - + + @@ -13671,8 +14635,8 @@ For more information see . - - + + @@ -13685,8 +14649,8 @@ For more information see . - - + + @@ -13699,8 +14663,8 @@ For more information see . - - + + @@ -13746,7 +14710,7 @@ WARNING Note that passing an to this method will print the name of the but no stack trace. To print a stack trace use the - form instead. + form instead. @@ -13763,10 +14727,10 @@ as a parameter. - See the form for more detailed information. + See the form for more detailed information. - + @@ -13776,18 +14740,18 @@ An Object array containing zero or more objects to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -13800,18 +14764,18 @@ An Object to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -13825,18 +14789,18 @@ An Object to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -13851,18 +14815,18 @@ An Object to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -13876,13 +14840,13 @@ An Object array containing zero or more objects to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -13908,7 +14872,7 @@ WARNING Note that passing an to this method will print the name of the but no stack trace. To print a stack trace use the - form instead. + form instead. @@ -13925,10 +14889,10 @@ passed as a parameter. - See the form for more detailed information. + See the form for more detailed information. - + @@ -13938,18 +14902,18 @@ An Object array containing zero or more objects to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -13962,18 +14926,18 @@ An Object to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -13987,18 +14951,18 @@ An Object to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -14013,18 +14977,18 @@ An Object to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -14038,13 +15002,13 @@ An Object array containing zero or more objects to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -14070,7 +15034,7 @@ WARNING Note that passing an to this method will print the name of the but no stack trace. To print a stack trace use the - form instead. + form instead. @@ -14087,10 +15051,10 @@ passed as a parameter. - See the form for more detailed information. + See the form for more detailed information. - + @@ -14100,18 +15064,18 @@ An Object array containing zero or more objects to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -14124,18 +15088,18 @@ An Object to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -14149,18 +15113,18 @@ An Object to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -14175,18 +15139,18 @@ An Object to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -14200,13 +15164,13 @@ An Object array containing zero or more objects to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -14232,7 +15196,7 @@ WARNING Note that passing an to this method will print the name of the but no stack trace. To print a stack trace use the - form instead. + form instead. @@ -14249,10 +15213,10 @@ passed as a parameter. - See the form for more detailed information. + See the form for more detailed information. - + @@ -14262,18 +15226,18 @@ An Object array containing zero or more objects to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -14286,18 +15250,18 @@ An Object to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -14311,18 +15275,18 @@ An Object to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -14337,18 +15301,18 @@ An Object to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -14362,13 +15326,13 @@ An Object array containing zero or more objects to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -14394,7 +15358,7 @@ WARNING Note that passing an to this method will print the name of the but no stack trace. To print a stack trace use the - form instead. + form instead. @@ -14411,10 +15375,10 @@ passed as a parameter. - See the form for more detailed information. + See the form for more detailed information. - + @@ -14424,18 +15388,18 @@ An Object array containing zero or more objects to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -14448,18 +15412,18 @@ An Object to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -14473,18 +15437,18 @@ An Object to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -14499,18 +15463,18 @@ An Object to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. The string is formatted using the format provider. To specify a localized provider use the - method. + method. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -14524,13 +15488,13 @@ An Object array containing zero or more objects to format - The message is formatted using the method. See + The message is formatted using the method. See String.Format for details of the syntax of the format string and the behavior of the formatting. This method does not take an object to include in the - log event. To pass an use one of the + log event. To pass an use one of the methods instead. @@ -14654,6 +15618,85 @@ + + + provides method information without actually referencing a System.Reflection.MethodBase + as that would require that the containing assembly is loaded. + + + + + + When location information is not available the constant + NA is returned. Current value of this string + constant is ?. + + + + + constructs a method item for an unknown method. + + + + + constructs a method item from the name of the method. + + + + + + constructs a method item from the name of the method and its parameters. + + + + + + + constructs a method item from a method base by determining the method name and its parameters. + + + + + + The fully qualified type of the StackFrameItem class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Gets the method name of the caller making the logging + request. + + + The method name of the caller making the logging + request. + + + + Gets the method name of the caller making the logging + request. + + + + + + Gets the method parameters of the caller making + the logging request. + + + The method parameters of the caller making + the logging request + + + + Gets the method parameters of the caller making + the logging request. + + + A SecurityContext used by log4net when interacting with protected resources @@ -14774,6 +15817,195 @@ + + + provides stack frame information without actually referencing a System.Diagnostics.StackFrame + as that would require that the containing assembly is loaded. + + + + + + When location information is not available the constant + NA is returned. Current value of this string + constant is ?. + + + + + returns a stack frame item from a stack frame. This + + + + + + + The fully qualified type of the StackFrameItem class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Gets the fully qualified class name of the caller making the logging + request. + + + The fully qualified class name of the caller making the logging + request. + + + + Gets the fully qualified class name of the caller making the logging + request. + + + + + + Gets the file name of the caller. + + + The file name of the caller. + + + + Gets the file name of the caller. + + + + + + Gets the line number of the caller. + + + The line number of the caller. + + + + Gets the line number of the caller. + + + + + + Gets the method name of the caller. + + + The method name of the caller. + + + + Gets the method name of the caller. + + + + + + Gets all available caller information + + + All available caller information, in the format + fully.qualified.classname.of.caller.methodName(Filename:line) + + + + Gets all available caller information, in the format + fully.qualified.classname.of.caller.methodName(Filename:line) + + + + + + An evaluator that triggers after specified number of seconds. + + + + This evaluator will trigger if the specified time period + has passed since last check. + + + Robert Sevcik + + + + The default time threshold for triggering in seconds. Zero means it won't trigger at all. + + + + + The time threshold for triggering in seconds. Zero means it won't trigger at all. + + + + + The time of last check. This gets updated when the object is created and when the evaluator triggers. + + + + + Create a new evaluator using the time threshold in seconds. + + + + Create a new evaluator using the time threshold in seconds. + + + This evaluator will trigger if the specified time period + has passed since last check. + + + + + + Create a new evaluator using the specified time threshold in seconds. + + + The time threshold in seconds to trigger after. + Zero means it won't trigger at all. + + + + Create a new evaluator using the specified time threshold in seconds. + + + This evaluator will trigger if the specified time period + has passed since last check. + + + + + + Is this the triggering event? + + The event to check + This method returns true, if the specified time period + has passed since last check.. + Otherwise it returns false + + + This evaluator will trigger if the specified time period + has passed since last check. + + + + + + The time threshold in seconds to trigger after + + + The time threshold in seconds to trigger after. + Zero means it won't trigger at all. + + + + This evaluator will trigger if the specified time period + has passed since last check. + + + Delegate used to handle creation of new wrappers. @@ -15010,7 +16242,7 @@ as a string. - + Last stored time with precision up to the second, formatted as a string. @@ -15103,11 +16335,11 @@ - Formats the using the method. + Formats the using the method. - Formats the using the method. + Formats the using the method. Nicko Cadell @@ -15125,20 +16357,20 @@ The format string must be compatible with the options - that can be supplied to . + that can be supplied to . - Formats the date using . + Formats the date using . The date to convert to a string. The writer to write to. Uses the date format string supplied to the constructor to call - the method to format the date. + the method to format the date. @@ -15149,7 +16381,7 @@ The format string must be compatible with the options - that can be supplied to . + that can be supplied to . @@ -15621,7 +16853,7 @@ The rendered message is matched against the . If the equals the beginning of - the incoming () + the incoming () then a match will have occurred. If no match occurs this function will return allowing other filters to check the event. If a match occurs then @@ -15655,7 +16887,7 @@ This filter will attempt to match this value against logger name in the following way. The match will be done against the beginning of the - logger name (using ). The match is + logger name (using ). The match is case sensitive. If a match is found then the result depends on the value of . @@ -16020,6 +17252,27 @@ + + + Write an dictionary to a + + the writer to write to + a to use for object conversion + the value to write to the writer + + + Writes the to a writer in the form: + + + {key1=value1, key2=value2, key3=value3} + + + If the specified + is not null then it is used to render the key and value to text, otherwise + the object's ToString method is called. + + + Write an object to a @@ -16074,6 +17327,11 @@ + + + + + Initializes a new instance of the class. @@ -16133,20 +17391,146 @@ - + - Date pattern converter, uses a to format - the date of a . + Converter for items in the ASP.Net Cache. - Render the to the writer as a string. + Outputs an item from the . + + Ron Grabowski + + + + Abstract class that provides access to the current HttpContext () that + derived classes need. + + + This class handles the case when HttpContext.Current is null by writing + to the writer. + + Ron Grabowski + + + + Derived pattern converters must override this method in order to + convert conversion specifiers in the correct way. + + that will receive the formatted result. + The on which the pattern converter should be executed. + The under which the ASP.Net request is running. + + + + Write the ASP.Net Cache item to the output + + that will receive the formatted result. + The on which the pattern converter should be executed. + The under which the ASP.Net request is running. + - The value of the determines - the formatting of the date. The following values are allowed: - - + Writes out the value of a named property. The property name + should be set in the + property. If no property has been set, all key value pairs from the Cache will + be written to the output. + + + + + + Converter for items in the . + + + + Outputs an item from the . + + + Ron Grabowski + + + + Write the ASP.Net HttpContext item to the output + + that will receive the formatted result. + The on which the pattern converter should be executed. + The under which the ASP.Net request is running. + + + Writes out the value of a named property. The property name + should be set in the + property. + + + + + + Converter for items in the ASP.Net Cache. + + + + Outputs an item from the . + + + Ron Grabowski + + + + Write the ASP.Net Cache item to the output + + that will receive the formatted result. + The on which the pattern converter should be executed. + The under which the ASP.Net request is running. + + + Writes out the value of a named property. The property name + should be set in the + property. + + + + + + Converter for items in the ASP.Net Cache. + + + + Outputs an item from the . + + + Ron Grabowski + + + + Write the ASP.Net Cache item to the output + + that will receive the formatted result. + The on which the pattern converter should be executed. + The under which the ASP.Net request is running. + + + Writes out the value of a named property. The property name + should be set in the + property. If no property has been set, all key value pairs from the Session will + be written to the output. + + + + + + Date pattern converter, uses a to format + the date of a . + + + + Render the to the writer as a string. + + + The value of the determines + the formatting of the date. The following values are allowed: + + Option value Output @@ -16176,7 +17560,7 @@ Any other pattern string uses the formatter. This formatter passes the pattern string to the - method. + method. For details on valid patterns see DateTimeFormatInfo Class. @@ -16234,6 +17618,15 @@ + + + The fully qualified type of the DatePatternConverter class. + + + Used by the internal logger to record the Type of the + log message. + + Write the exception text to the output @@ -16271,11 +17664,32 @@ trailing newline. - If there is no exception then nothing will be output + If there is no exception or the exception property specified + by the Option value does not exist then nothing will be output and no trailing newline will be appended. It is typical to put a newline before the exception and to have the exception as the last data in the pattern. + + Recognized values for the Option parameter are: + + + + Message + + + Source + + + StackTrace + + + TargetSite + + + HelpLink + + @@ -16476,6 +17890,15 @@ specified by the property. + + + The fully qualified type of the NamedPatternConverter class. + + + Used by the internal logger to record the Type of the + log message. + + Gets the fully qualified name of the logger @@ -16636,6 +18059,86 @@ end time (in the current local time zone) the time difference in milliseconds + + + Write the caller stack frames to the output + + + + Writes the to the output writer, using format: + type3.MethodCall3(type param,...) > type2.MethodCall2(type param,...) > type1.MethodCall1(type param,...) + + + Adam Davies + + + + Write the caller stack frames to the output + + + + Writes the to the output writer, using format: + type3.MethodCall3 > type2.MethodCall2 > type1.MethodCall1 + + + Michael Cromwell + + + + Initialize the converter + + + + 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. + + + + + + Write the strack frames to the output + + that will receive the formatted result. + the event being logged + + + Writes the to the output writer. + + + + + + Returns the Name of the method + + + This method was created, so this class could be used as a base class for StackTraceDetailPatternConverter + string + + + + The fully qualified type of the StackTracePatternConverter class. + + + Used by the internal logger to record the Type of the + log message. + + + + + The fully qualified type of the StackTraceDetailPatternConverter class. + + + Used by the internal logger to record the Type of the + log message. + + Converter to include event thread name @@ -16734,439 +18237,92 @@ - + - A Layout that renders only the Exception text from the logging event + The fully qualified type of the UtcDatePatternConverter class. - - A Layout that renders only the Exception text from the logging event. - - - This Layout should only be used with appenders that utilize multiple - layouts (e.g. ). - + Used by the internal logger to record the Type of the + log message. - Nicko Cadell - Gert Driesen - + - Extend this abstract class to create your own log layout format. + A flexible layout configurable with pattern string that re-evaluates on each call. - - This is the base implementation of the - interface. Most layout objects should extend this class. - - - - - - Subclasses must implement the - method. - - - Subclasses should set the in their default - constructor. - - + This class is built on and provides all the + features and capabilities of PatternLayout. PatternLayout is a 'static' class + in that its layout is done once at configuration time. This class will recreate + the layout on each reference. + One important difference between PatternLayout and DynamicPatternLayout is the + treatment of the Header and Footer parameters in the configuration. The Header and Footer + parameters for DynamicPatternLayout must be syntactically in the form of a PatternString, + but should not be marked as type log4net.Util.PatternString. Doing so causes the + pattern to be statically converted at configuration time and causes DynamicPatternLayout + to perform the same as PatternLayout. + Please see for complete documentation. + + <layout type="log4net.Layout.DynamicPatternLayout"> + <param name="Header" value="%newline**** Trace Opened Local: %date{yyyy-MM-dd HH:mm:ss.fff} UTC: %utcdate{yyyy-MM-dd HH:mm:ss.fff} ****%newline" /> + <param name="Footer" value="**** Trace Closed %date{yyyy-MM-dd HH:mm:ss.fff} ****%newline" /> + </layout> + - Nicko Cadell - Gert Driesen - + - Interface implemented by layout objects + A flexible layout configurable with pattern string. - An object is used to format a - as text. The method is called by an - appender to transform the into a string. + The goal of this class is to a + as a string. The results + depend on the conversion pattern. - The layout can also supply and - text that is appender before any events and after all the events respectively. + The conversion pattern is closely related to the conversion + pattern of the printf function in C. A conversion pattern is + composed of literal text and format control expressions called + conversion specifiers. - - Nicko Cadell - Gert Driesen - - - - Implement this method to create your own layout format. - - The TextWriter to write the formatted event to - The event to format - - This method is called by an appender to format - the as text and output to a writer. + You are free to insert any literal text within the conversion + pattern. - If the caller does not have a and prefers the - event to be formatted as a then the following - code can be used to format the event into a . + Each conversion specifier starts with a percent sign (%) and is + followed by optional format modifiers and a conversion + pattern name. The conversion pattern name specifies the type of + data, e.g. logger, level, date, thread name. The format + modifiers control such things as field width, padding, left and + right justification. The following is a simple example. + + + Let the conversion pattern be "%-5level [%thread]: %message%newline" and assume + that the log4net environment was set to use a PatternLayout. Then the + statements - StringWriter writer = new StringWriter(); - Layout.Format(writer, loggingEvent); - string formattedEvent = writer.ToString(); + ILog log = LogManager.GetLogger(typeof(TestApp)); + log.Debug("Message 1"); + log.Warn("Message 2"); + + would yield the output + + DEBUG [main]: Message 1 + WARN [main]: Message 2 - - - - - The content type output by this layout. - - The content type - - The content type output by this layout. + Note that there is no explicit separator between text and + conversion specifiers. The pattern parser knows when it has reached + the end of a conversion specifier when it reads a conversion + character. In the example above the conversion specifier + %-5level means the level of the logging event should be left + justified to a width of five characters. - This is a MIME type e.g. "text/plain". - - - - - - The header for the layout format. - - the layout header - - - The Header text will be appended before any logging events - are formatted and appended. - - - - - - The footer for the layout format. - - the layout footer - - - The Footer text will be appended after all the logging events - have been formatted and appended. - - - - - - Flag indicating if this layout handle exceptions - - false if this layout handles exceptions - - - If this layout handles the exception object contained within - , then the layout should return - false. Otherwise, if the layout ignores the exception - object, then the layout should return true. - - - - - - The header text - - - - See for more information. - - - - - - The footer text - - - - See for more information. - - - - - - Flag indicating if this layout handles exceptions - - - - false if this layout handles exceptions - - - - - - Empty default constructor - - - - Empty default constructor - - - - - - Activate component options - - - - 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 must be implemented by the subclass. - - - - - - Implement this method to create your own layout format. - - The TextWriter to write the formatted event to - The event to format - - - This method is called by an appender to format - the as text. - - - - - - The content type output by this layout. - - The content type is "text/plain" - - - The content type output by this layout. - - - This base class uses the value "text/plain". - To change this value a subclass must override this - property. - - - - - - The header for the layout format. - - the layout header - - - The Header text will be appended before any logging events - are formatted and appended. - - - - - - The footer for the layout format. - - the layout footer - - - The Footer text will be appended after all the logging events - have been formatted and appended. - - - - - - Flag indicating if this layout handles exceptions - - false if this layout handles exceptions - - - If this layout handles the exception object contained within - , then the layout should return - false. Otherwise, if the layout ignores the exception - object, then the layout should return true. - - - Set this value to override a this default setting. The default - value is true, this layout does not handle the exception. - - - - - - Default constructor - - - - Constructs a ExceptionLayout - - - - - - Activate component options - - - - Part of the component activation - framework. - - - This method does nothing as options become effective immediately. - - - - - - Gets the exception text from the logging event - - The TextWriter to write the formatted event to - the event being logged - - - Write the exception string to the . - The exception string is retrieved from . - - - - - - Interface for raw layout objects - - - - Interface used to format a - to an object. - - - This interface should not be confused with the - interface. This interface is used in - only certain specialized situations where a raw object is - required rather than a formatted string. The - is not generally useful than this interface. - - - Nicko Cadell - Gert Driesen - - - - Implement this method to create your own layout format. - - The event to format - returns the formatted event - - - Implement this method to create your own layout format. - - - - - - Adapts any to a - - - - Where an is required this adapter - allows a to be specified. - - - Nicko Cadell - Gert Driesen - - - - The layout to adapt - - - - - Construct a new adapter - - the layout to adapt - - - Create the adapter for the specified . - - - - - - Format the logging event as an object. - - The event to format - returns the formatted event - - - Format the logging event as an object. - - - Uses the object supplied to - the constructor to perform the formatting. - - - - - - A flexible layout configurable with pattern string. - - - - The goal of this class is to a - as a string. The results - depend on the conversion pattern. - - - The conversion pattern is closely related to the conversion - pattern of the printf function in C. A conversion pattern is - composed of literal text and format control expressions called - conversion specifiers. - - - You are free to insert any literal text within the conversion - pattern. - - - Each conversion specifier starts with a percent sign (%) and is - followed by optional format modifiers and a conversion - pattern name. The conversion pattern name specifies the type of - data, e.g. logger, level, date, thread name. The format - modifiers control such things as field width, padding, left and - right justification. The following is a simple example. - - - Let the conversion pattern be "%-5level [%thread]: %message%newline" and assume - that the log4net environment was set to use a PatternLayout. Then the - statements - - - ILog log = LogManager.GetLogger(typeof(TestApp)); - log.Debug("Message 1"); - log.Warn("Message 2"); - - would yield the output - - DEBUG [main]: Message 1 - WARN [main]: Message 2 - - - Note that there is no explicit separator between text and - conversion specifiers. The pattern parser knows when it has reached - the end of a conversion specifier when it reads a conversion - character. In the example above the conversion specifier - %-5level means the level of the logging event should be left - justified to a width of five characters. - - - The recognized conversion pattern names are: + The recognized conversion pattern names are: @@ -17184,6 +18340,50 @@ logging event was generated. + + aspnet-cache + + + Used to output all cache items in the case of %aspnet-cache or just one named item if used as %aspnet-cache{key} + + + This pattern is not available for Compact Framework or Client Profile assemblies. + + + + + aspnet-context + + + Used to output all context items in the case of %aspnet-context or just one named item if used as %aspnet-context{key} + + + This pattern is not available for Compact Framework or Client Profile assemblies. + + + + + aspnet-request + + + Used to output all request parameters in the case of %aspnet-request or just one named param if used as %aspnet-request{key} + + + This pattern is not available for Compact Framework or Client Profile assemblies. + + + + + aspnet-session + + + Used to output all session items in the case of %aspnet-session or just one named item if used as %aspnet-session{key} + + + This pattern is not available for Compact Framework or Client Profile assemblies. + + + c Equivalent to logger @@ -17215,7 +18415,7 @@ The date format specifier admits the same syntax as the - time pattern string of the . + time pattern string of the . For better results it is recommended to use the log4net date @@ -17228,7 +18428,7 @@ These dedicated date formatters perform significantly - better than . + better than . @@ -17494,6 +18694,42 @@ r Equivalent to timestamp + + stacktrace + + + Used to output the stack trace of the logging event + The stack trace level specifier may be enclosed + between braces. For example, %stacktrace{level}. + If no stack trace level specifier is given then 1 is assumed + + + Output uses the format: + type3.MethodCall3 > type2.MethodCall2 > type1.MethodCall1 + + + This pattern is not available for Compact Framework assemblies. + + + + + stacktracedetail + + + Used to output the stack trace of the logging event + The stack trace level specifier may be enclosed + between braces. For example, %stacktracedetail{level}. + If no stack trace level specifier is given then 1 is assumed + + + Output uses the format: + type3.MethodCall3(type param,...) > type2.MethodCall2(type param,...) > type1.MethodCall1(type param,...) + + + This pattern is not available for Compact Framework assemblies. + + + t Equivalent to thread @@ -17576,7 +18812,7 @@ The date format specifier admits the same syntax as the - time pattern string of the . + time pattern string of the . For better results it is recommended to use the log4net date @@ -17589,7 +18825,7 @@ These dedicated date formatters perform significantly - better than . + better than . @@ -17615,6656 +18851,8659 @@ - The single letter patterns are deprecated in favor of the - longer more descriptive pattern names. + The single letter patterns are deprecated in favor of the + longer more descriptive pattern names. + + + By default the relevant information is output as is. However, + with the aid of format modifiers it is possible to change the + minimum field width, the maximum field width and justification. + + + The optional format modifier is placed between the percent sign + and the conversion pattern name. + + + The first optional format modifier is the left justification + flag which is just the minus (-) character. Then comes the + optional minimum field width modifier. This is a decimal + constant that represents the minimum number of characters to + output. If the data item requires fewer characters, it is padded on + either the left or the right until the minimum width is + reached. The default is to pad on the left (right justify) but you + can specify right padding with the left justification flag. The + padding character is space. If the data item is larger than the + minimum field width, the field is expanded to accommodate the + data. The value is never truncated. + + + This behavior can be changed using the maximum field + width modifier which is designated by a period followed by a + decimal constant. If the data item is longer than the maximum + field, then the extra characters are removed from the + beginning of the data item and not from the end. For + example, it the maximum field width is eight and the data item is + ten characters long, then the first two characters of the data item + are dropped. This behavior deviates from the printf function in C + where truncation is done from the end. + + + Below are various format modifier examples for the logger + conversion specifier. + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Format modifierleft justifyminimum widthmaximum widthcomment
%20loggerfalse20none + + Left pad with spaces if the logger name is less than 20 + characters long. + +
%-20loggertrue20none + + Right pad with spaces if the logger + name is less than 20 characters long. + +
%.30loggerNAnone30 + + Truncate from the beginning if the logger + name is longer than 30 characters. + +
%20.30loggerfalse2030 + + Left pad with spaces if the logger name is shorter than 20 + characters. However, if logger name is longer than 30 characters, + then truncate from the beginning. + +
%-20.30loggertrue2030 + + Right pad with spaces if the logger name is shorter than 20 + characters. However, if logger name is longer than 30 characters, + then truncate from the beginning. + +
+
+ + Note about caller location information.
+ The following patterns %type %file %line %method %location %class %C %F %L %l %M + all generate caller location information. + Location information uses the System.Diagnostics.StackTrace class to generate + a call stack. The caller's information is then extracted from this stack. +
+ + + The System.Diagnostics.StackTrace class is not supported on the + .NET Compact Framework 1.0 therefore caller location information is not + available on that framework. + + + + + The System.Diagnostics.StackTrace class has this to say about Release builds: + + + "StackTrace information will be most informative with Debug build configurations. + By default, Debug builds include debug symbols, while Release builds do not. The + debug symbols contain most of the file, method name, line number, and column + information used in constructing StackFrame and StackTrace objects. StackTrace + might not report as many method calls as expected, due to code transformations + that occur during optimization." + + + This means that in a Release build the caller information may be incomplete or may + not exist at all! Therefore caller location information cannot be relied upon in a Release build. + + + + Additional pattern converters may be registered with a specific + instance using the method. + +
+ + This is a more detailed pattern. + %timestamp [%thread] %level %logger %ndc - %message%newline + + + A similar pattern except that the relative time is + right padded if less than 6 digits, thread name is right padded if + less than 15 characters and truncated if longer and the logger + name is left padded if shorter than 30 characters and truncated if + longer. + %-6timestamp [%15.15thread] %-5level %30.30logger %ndc - %message%newline + + Nicko Cadell + Gert Driesen + Douglas de la Torre + Daniel Cazzulino +
+ + + Extend this abstract class to create your own log layout format. + + + + This is the base implementation of the + interface. Most layout objects should extend this class. + + + + + + Subclasses must implement the + method. + + + Subclasses should set the in their default + constructor. + + + + Nicko Cadell + Gert Driesen + + + + Interface implemented by layout objects + + + + An object is used to format a + as text. The method is called by an + appender to transform the into a string. + + + The layout can also supply and + text that is appender before any events and after all the events respectively. + + + Nicko Cadell + Gert Driesen + + + + Implement this method to create your own layout format. + + The TextWriter to write the formatted event to + The event to format + + + This method is called by an appender to format + the as text and output to a writer. + + + If the caller does not have a and prefers the + event to be formatted as a then the following + code can be used to format the event into a . + + + StringWriter writer = new StringWriter(); + Layout.Format(writer, loggingEvent); + string formattedEvent = writer.ToString(); + + + + + + The content type output by this layout. + + The content type + + + The content type output by this layout. + + + This is a MIME type e.g. "text/plain". + + + + + + The header for the layout format. + + the layout header + + + The Header text will be appended before any logging events + are formatted and appended. + + + + + + The footer for the layout format. + + the layout footer + + + The Footer text will be appended after all the logging events + have been formatted and appended. + + + + + + Flag indicating if this layout handle exceptions + + false if this layout handles exceptions + + + If this layout handles the exception object contained within + , then the layout should return + false. Otherwise, if the layout ignores the exception + object, then the layout should return true. + + + + + + The header text + + + + See for more information. + + + + + + The footer text + + + + See for more information. + + + + + + Flag indicating if this layout handles exceptions + + + + false if this layout handles exceptions + + + + + + Empty default constructor + + + + Empty default constructor + + + + + + Activate component options + + + + 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 must be implemented by the subclass. + + + + + + Implement this method to create your own layout format. + + The TextWriter to write the formatted event to + The event to format + + + This method is called by an appender to format + the as text. + + + + + + Convenience method for easily formatting the logging event into a string variable. + + + + Creates a new StringWriter instance to store the formatted logging event. + + + + + The content type output by this layout. + + The content type is "text/plain" + + + The content type output by this layout. + + + This base class uses the value "text/plain". + To change this value a subclass must override this + property. + + + + + + The header for the layout format. + + the layout header + + + The Header text will be appended before any logging events + are formatted and appended. + + + + + + The footer for the layout format. + + the layout footer + + + The Footer text will be appended after all the logging events + have been formatted and appended. + + + + + + Flag indicating if this layout handles exceptions + + false if this layout handles exceptions + + + If this layout handles the exception object contained within + , then the layout should return + false. Otherwise, if the layout ignores the exception + object, then the layout should return true. + + + Set this value to override a this default setting. The default + value is true, this layout does not handle the exception. + + + + + + Default pattern string for log output. + + + + Default pattern string for log output. + Currently set to the string "%message%newline" + which just prints the application supplied message. + + + + + + A detailed conversion pattern + + + + A conversion pattern which includes Time, Thread, Logger, and Nested Context. + Current value is %timestamp [%thread] %level %logger %ndc - %message%newline. + + + + + + Internal map of converter identifiers to converter types. + + + + This static map is overridden by the m_converterRegistry instance map + + + + + + the pattern + + + + + the head of the pattern converter chain + + + + + patterns defined on this PatternLayout only + + + + + Initialize the global registry + + + + Defines the builtin global rules. + + + + + + Constructs a PatternLayout using the DefaultConversionPattern + + + + The default pattern just produces the application supplied message. + + + Note to Inheritors: This constructor calls the virtual method + . If you override this method be + aware that it will be called before your is called constructor. + + + As per the contract the + method must be called after the properties on this object have been + configured. + + + + + + Constructs a PatternLayout using the supplied conversion pattern + + the pattern to use + + + Note to Inheritors: This constructor calls the virtual method + . If you override this method be + aware that it will be called before your is called constructor. + + + When using this constructor the method + need not be called. This may not be the case when using a subclass. + + + + + + Create the pattern parser instance + + the pattern to parse + The that will format the event + + + Creates the used to parse the conversion string. Sets the + global and instance rules on the . + + + + + + Initialize layout options + + + + 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. + + + + + + Produces a formatted string as specified by the conversion pattern. + + the event being logged + The TextWriter to write the formatted event to + + + Parse the using the patter format + specified in the property. + + + + + + Add a converter to this PatternLayout + + the converter info + + + This version of the method is used by the configurator. + Programmatic users should use the alternative method. + + + + + + Add a converter to this PatternLayout + + the name of the conversion pattern for this converter + the type of the converter + + + Add a named pattern converter to this instance. This + converter will be used in the formatting of the event. + This method must be called before . + + + The specified must extend the + type. + + + + + + The pattern formatting string + + + + The ConversionPattern option. This is the string which + controls formatting and consists of a mix of literal content and + conversion specifiers. + + + + + + The header PatternString + + + + + The footer PatternString + + + + + Constructs a DynamicPatternLayout using the DefaultConversionPattern + + + + The default pattern just produces the application supplied message. + + + + + + Constructs a DynamicPatternLayout using the supplied conversion pattern + + the pattern to use + + + + + + The header for the layout format. + + the layout header + + + The Header text will be appended before any logging events + are formatted and appended. + + The pattern will be formatted on each get operation. + + + + + The footer for the layout format. + + the layout footer + + + The Footer text will be appended after all the logging events + have been formatted and appended. + + The pattern will be formatted on each get operation. + + + + + A Layout that renders only the Exception text from the logging event + + + + A Layout that renders only the Exception text from the logging event. + + + This Layout should only be used with appenders that utilize multiple + layouts (e.g. ). + + + Nicko Cadell + Gert Driesen + + + + Default constructor + + + + Constructs a ExceptionLayout + + + + + + Activate component options + + + + Part of the component activation + framework. + + + This method does nothing as options become effective immediately. + + + + + + Gets the exception text from the logging event + + The TextWriter to write the formatted event to + the event being logged + + + Write the exception string to the . + The exception string is retrieved from . + + + + + + Interface for raw layout objects + + + + Interface used to format a + to an object. + + + This interface should not be confused with the + interface. This interface is used in + only certain specialized situations where a raw object is + required rather than a formatted string. The + is not generally useful than this interface. + + + Nicko Cadell + Gert Driesen + + + + Implement this method to create your own layout format. + + The event to format + returns the formatted event + + + Implement this method to create your own layout format. + + + + + + Adapts any to a + + + + Where an is required this adapter + allows a to be specified. + + + Nicko Cadell + Gert Driesen + + + + The layout to adapt + + + + + Construct a new adapter + + the layout to adapt + + + Create the adapter for the specified . + + + + + + Format the logging event as an object. + + The event to format + returns the formatted event + + + Format the logging event as an object. + + + Uses the object supplied to + the constructor to perform the formatting. + + + + + + Type converter for the interface + + + + Used to convert objects to the interface. + Supports converting from the interface to + the interface using the . + + + Nicko Cadell + Gert Driesen + + + + Interface supported by type converters + + + + This interface supports conversion from arbitrary types + to a single target type. See . + + + Nicko Cadell + Gert Driesen + + + + Can the source type be converted to the type supported by this object + + the type to convert + true if the conversion is possible + + + Test if the can be converted to the + type supported by this converter. + + + + + + Convert the source object to the type supported by this object + + the object to convert + the converted object + + + Converts the to the type supported + by this converter. + + + + + + Can the sourceType be converted to an + + the source to be to be converted + true if the source type can be converted to + + + Test if the can be converted to a + . Only is supported + as the . + + + + + + Convert the value to a object + + the value to convert + the object + + + Convert the object to a + object. If the object + is a then the + is used to adapt between the two interfaces, otherwise an + exception is thrown. + + + + + + Extract the value of a property from the + + + + Extract the value of a property from the + + + Nicko Cadell + + + + Constructs a RawPropertyLayout + + + + + Lookup the property for + + The event to format + returns property value + + + Looks up and returns the object value of the property + named . If there is no property defined + with than name then null will be returned. + + + + + + The name of the value to lookup in the LoggingEvent Properties collection. + + + Value to lookup in the LoggingEvent Properties collection + + + + String name of the property to lookup in the . + + + + + + Extract the date from the + + + + Extract the date from the + + + Nicko Cadell + Gert Driesen + + + + Constructs a RawTimeStampLayout + + + + + Gets the as a . + + The event to format + returns the time stamp + + + Gets the as a . + + + The time stamp is in local time. To format the time stamp + in universal time use . + + + + + + Extract the date from the + + + + Extract the date from the + + + Nicko Cadell + Gert Driesen + + + + Constructs a RawUtcTimeStampLayout + + + + + Gets the as a . + + The event to format + returns the time stamp + + + Gets the as a . + + + The time stamp is in universal time. To format the time stamp + in local time use . + + + + + + A very simple layout + + + + SimpleLayout consists of the level of the log statement, + followed by " - " and then the log message itself. For example, + + DEBUG - Hello world + + + + Nicko Cadell + Gert Driesen + + + + Constructs a SimpleLayout + + + + + Initialize layout options + + + + 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. + + + + + + Produces a simple formatted output. + + the event being logged + The TextWriter to write the formatted event to + + + Formats the event as the level of the even, + followed by " - " and then the log message itself. The + output is terminated by a newline. + + + + + + Layout that formats the log events as XML elements. + + + + The output of the consists of a series of + log4net:event elements. It does not output a complete well-formed XML + file. The output is designed to be included as an external entity + in a separate file to form a correct XML file. + + + For example, if abc is the name of the file where + the output goes, then a well-formed XML file would + be: + + + <?xml version="1.0" ?> + + <!DOCTYPE log4net:events SYSTEM "log4net-events.dtd" [<!ENTITY data SYSTEM "abc">]> + + <log4net:events version="1.2" xmlns:log4net="http://logging.apache.org/log4net/schemas/log4net-events-1.2> + &data; + </log4net:events> + + + This approach enforces the independence of the + and the appender where it is embedded. + + + The version attribute helps components to correctly + interpret output generated by . The value of + this attribute should be "1.2" for release 1.2 and later. + + + Alternatively the Header and Footer properties can be + configured to output the correct XML header, open tag and close tag. + When setting the Header and Footer properties it is essential + that the underlying data store not be appendable otherwise the data + will become invalid XML. + + + Nicko Cadell + Gert Driesen + + + + Layout that formats the log events as XML elements. + + + + This is an abstract class that must be subclassed by an implementation + to conform to a specific schema. + + + Deriving classes must implement the method. + + + Nicko Cadell + Gert Driesen + + + + Protected constructor to support subclasses + + + + Initializes a new instance of the class + with no location info. + + + + + + Protected constructor to support subclasses + + + + The parameter determines whether + location information will be output by the layout. If + is set to true, then the + file name and line number of the statement at the origin of the log + statement will be output. + + + If you are embedding this layout within an SMTPAppender + then make sure to set the LocationInfo option of that + appender as well. + + + + + + Initialize layout options + + + + 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. + + + + + + Produces a formatted string. + + The event being logged. + The TextWriter to write the formatted event to + + + Format the and write it to the . + + + This method creates an that writes to the + . The is passed + to the method. Subclasses should override the + method rather than this method. + + + + + + Does the actual writing of the XML. + + The writer to use to output the event to. + The event to write. + + + Subclasses should override this method to format + the as XML. + + + + + + Flag to indicate if location information should be included in + the XML events. + + + + + The string to replace invalid chars with + + + + + Gets a value indicating whether to include location information in + the XML events. + + + true if location information should be included in the XML + events; otherwise, false. + + + + If is set to true, then the file + name and line number of the statement at the origin of the log + statement will be output. + + + If you are embedding this layout within an SMTPAppender + then make sure to set the LocationInfo option of that + appender as well. + + + + + + The string to replace characters that can not be expressed in XML with. + + + Not all characters may be expressed in XML. This property contains the + string to replace those that can not with. This defaults to a ?. Set it + to the empty string to simply remove offending characters. For more + details on the allowed character ranges see http://www.w3.org/TR/REC-xml/#charsets + Character replacement will occur in the log message, the property names + and the property values. + + + + + + + Gets the content type output by this layout. + + + As this is the XML layout, the value is always "text/xml". + + + + As this is the XML layout, the value is always "text/xml". + + + + + + Constructs an XmlLayout + + + + + Constructs an XmlLayout. + + + + The LocationInfo option takes a boolean value. By + default, it is set to false which means there will be no location + information output by this layout. If the the option is set to + true, then the file name and line number of the statement + at the origin of the log statement will be output. + + + If you are embedding this layout within an SmtpAppender + then make sure to set the LocationInfo option of that + appender as well. + + + + + + Initialize layout options + + + + 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. + + + Builds a cache of the element names + + + + + + Does the actual writing of the XML. + + The writer to use to output the event to. + The event to write. + + + Override the base class method + to write the to the . + + + + + + The prefix to use for all generated element names + + + + + The prefix to use for all element names + + + + The default prefix is log4net. Set this property + to change the prefix. If the prefix is set to an empty string + then no prefix will be written. + + + + + + Set whether or not to base64 encode the message. + + + + By default the log message will be written as text to the xml + output. This can cause problems when the message contains binary + data. By setting this to true the contents of the message will be + base64 encoded. If this is set then invalid character replacement + (see ) will not be performed + on the log message. + + + + + + Set whether or not to base64 encode the property values. + + + + By default the properties will be written as text to the xml + output. This can cause problems when one or more properties contain + binary data. By setting this to true the values of the properties + will be base64 encoded. If this is set then invalid character replacement + (see ) will not be performed + on the property values. + + + + + Layout that formats the log events as XML elements compatible with the log4j schema + + - By default the relevant information is output as is. However, - with the aid of format modifiers it is possible to change the - minimum field width, the maximum field width and justification. + Formats the log events according to the http://logging.apache.org/log4j schema. + + Nicko Cadell + + + + The 1st of January 1970 in UTC + + + + + Constructs an XMLLayoutSchemaLog4j + + + + + Constructs an XMLLayoutSchemaLog4j. + + - The optional format modifier is placed between the percent sign - and the conversion pattern name. + The LocationInfo option takes a boolean value. By + default, it is set to false which means there will be no location + information output by this layout. If the the option is set to + true, then the file name and line number of the statement + at the origin of the log statement will be output. - The first optional format modifier is the left justification - flag which is just the minus (-) character. Then comes the - optional minimum field width modifier. This is a decimal - constant that represents the minimum number of characters to - output. If the data item requires fewer characters, it is padded on - either the left or the right until the minimum width is - reached. The default is to pad on the left (right justify) but you - can specify right padding with the left justification flag. The - padding character is space. If the data item is larger than the - minimum field width, the field is expanded to accommodate the - data. The value is never truncated. + If you are embedding this layout within an SMTPAppender + then make sure to set the LocationInfo option of that + appender as well. + + + + + Actually do the writing of the xml + + the writer to use + the event to write + - This behavior can be changed using the maximum field - width modifier which is designated by a period followed by a - decimal constant. If the data item is longer than the maximum - field, then the extra characters are removed from the - beginning of the data item and not from the end. For - example, it the maximum field width is eight and the data item is - ten characters long, then the first two characters of the data item - are dropped. This behavior deviates from the printf function in C - where truncation is done from the end. + Generate XML that is compatible with the log4j schema. + + + + + The version of the log4j schema to use. + + - Below are various format modifier examples for the logger - conversion specifier. + Only version 1.2 of the log4j schema is supported. -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Format modifierleft justifyminimum widthmaximum widthcomment
%20loggerfalse20none - - Left pad with spaces if the logger name is less than 20 - characters long. - -
%-20loggertrue20none - - Right pad with spaces if the logger - name is less than 20 characters long. - -
%.30loggerNAnone30 - - Truncate from the beginning if the logger - name is longer than 30 characters. - -
%20.30loggerfalse2030 - - Left pad with spaces if the logger name is shorter than 20 - characters. However, if logger name is longer than 30 characters, - then truncate from the beginning. - -
%-20.30loggertrue2030 - - Right pad with spaces if the logger name is shorter than 20 - characters. However, if logger name is longer than 30 characters, - then truncate from the beginning. - -
-
+
+
+ + + The default object Renderer. + + - Note about caller location information.
- The following patterns %type %file %line %method %location %class %C %F %L %l %M - all generate caller location information. - Location information uses the System.Diagnostics.StackTrace class to generate - a call stack. The caller's information is then extracted from this stack. + The default renderer supports rendering objects and collections to strings.
- - The System.Diagnostics.StackTrace class is not supported on the - .NET Compact Framework 1.0 therefore caller location information is not - available on that framework. + See the method for details of the output. - - +
+ Nicko Cadell + Gert Driesen +
+ + + Implement this interface in order to render objects as strings + + - The System.Diagnostics.StackTrace class has this to say about Release builds: + Certain types require special case conversion to + string form. This conversion is done by an object renderer. + Object renderers implement the + interface. + + Nicko Cadell + Gert Driesen + + + + Render the object to a string + + The map used to lookup renderers + The object to render + The writer to render to + - "StackTrace information will be most informative with Debug build configurations. - By default, Debug builds include debug symbols, while Release builds do not. The - debug symbols contain most of the file, method name, line number, and column - information used in constructing StackFrame and StackTrace objects. StackTrace - might not report as many method calls as expected, due to code transformations - that occur during optimization." + Render the object to a + string. + + + The parameter is + provided to lookup and render other objects. This is + very useful where contains + nested objects of unknown type. The + method can be used to render these objects. + + + + + + Default constructor + + + + Default constructor + + + + + + Render the object to a string + + The map used to lookup renderers + The object to render + The writer to render to + + + Render the object to a string. - This means that in a Release build the caller information may be incomplete or may - not exist at all! Therefore caller location information cannot be relied upon in a Release build. + The parameter is + provided to lookup and render other objects. This is + very useful where contains + nested objects of unknown type. The + method can be used to render these objects. - - Additional pattern converters may be registered with a specific - instance using the method. + The default renderer supports rendering objects to strings as follows: + + + Value + Rendered String + + + null + + "(null)" + + + + + + + For a one dimensional array this is the + array type name, an open brace, followed by a comma + separated list of the elements (using the appropriate + renderer), followed by a close brace. + + + For example: int[] {1, 2, 3}. + + + If the array is not one dimensional the + Array.ToString() is returned. + + + + + , & + + + Rendered as an open brace, followed by a comma + separated list of the elements (using the appropriate + renderer), followed by a close brace. + + + For example: {a, b, c}. + + + All collection classes that implement its subclasses, + or generic equivalents all implement the interface. + + + + + + + + Rendered as the key, an equals sign ('='), and the value (using the appropriate + renderer). + + + For example: key=value. + + + + + other + + Object.ToString() + + + - - This is a more detailed pattern. - %timestamp [%thread] %level %logger %ndc - %message%newline - - - A similar pattern except that the relative time is - right padded if less than 6 digits, thread name is right padded if - less than 15 characters and truncated if longer and the logger - name is left padded if shorter than 30 characters and truncated if - longer. - %-6timestamp [%15.15thread] %-5level %30.30logger %ndc - %message%newline - - Nicko Cadell - Gert Driesen - Douglas de la Torre - Daniel Cazzulino - + - Default pattern string for log output. + Render the array argument into a string + The map used to lookup renderers + the array to render + The writer to render to - Default pattern string for log output. - Currently set to the string "%message%newline" - which just prints the application supplied message. + For a one dimensional array this is the + array type name, an open brace, followed by a comma + separated list of the elements (using the appropriate + renderer), followed by a close brace. For example: + int[] {1, 2, 3}. + + + If the array is not one dimensional the + Array.ToString() is returned. - + - A detailed conversion pattern + Render the enumerator argument into a string + The map used to lookup renderers + the enumerator to render + The writer to render to - A conversion pattern which includes Time, Thread, Logger, and Nested Context. - Current value is %timestamp [%thread] %level %logger %ndc - %message%newline. + Rendered as an open brace, followed by a comma + separated list of the elements (using the appropriate + renderer), followed by a close brace. For example: + {a, b, c}. - + - Internal map of converter identifiers to converter types. + Render the DictionaryEntry argument into a string + The map used to lookup renderers + the DictionaryEntry to render + The writer to render to - This static map is overridden by the m_converterRegistry instance map + Render the key, an equals sign ('='), and the value (using the appropriate + renderer). For example: key=value. - + - the pattern + Map class objects to an . + + + Maintains a mapping between types that require special + rendering and the that + is used to render them. + + + The method is used to render an + object using the appropriate renderers defined in this map. + + + Nicko Cadell + Gert Driesen - + - the head of the pattern converter chain + Default Constructor + + + Default constructor. + + - + - patterns defined on this PatternLayout only + Render using the appropriate renderer. + the object to render to a string + the object rendered as a string + + + This is a convenience method used to render an object to a string. + The alternative method + should be used when streaming output to a . + + - + - Initialize the global registry + Render using the appropriate renderer. + the object to render to a string + The writer to render to - Defines the builtin global rules. + Find the appropriate renderer for the type of the + parameter. This is accomplished by calling the + method. Once a renderer is found, it is + applied on the object and the result is returned + as a . - + - Constructs a PatternLayout using the DefaultConversionPattern + Gets the renderer for the specified object type + the object to lookup the renderer for + the renderer for - - The default pattern just produces the application supplied message. - - - Note to Inheritors: This constructor calls the virtual method - . If you override this method be - aware that it will be called before your is called constructor. - - - As per the contract the - method must be called after the properties on this object have been - configured. - + + Gets the renderer for the specified object type. + + + Syntactic sugar method that calls + with the type of the object parameter. + - + - Constructs a PatternLayout using the supplied conversion pattern + Gets the renderer for the specified type - the pattern to use + the type to lookup the renderer for + the renderer for the specified type - Note to Inheritors: This constructor calls the virtual method - . If you override this method be - aware that it will be called before your is called constructor. - - - When using this constructor the method - need not be called. This may not be the case when using a subclass. + Returns the renderer for the specified type. + If no specific renderer has been defined the + will be returned. - + - Create the pattern parser instance + Internal function to recursively search interfaces + + the type to lookup the renderer for + the renderer for the specified type + + + + Clear the map of renderers - the pattern to parse - The that will format the event - Creates the used to parse the conversion string. Sets the - global and instance rules on the . + Clear the custom renderers defined by using + . The + cannot be removed. - + - Initialize layout options + Register an for . + the type that will be rendered by + the renderer for - - 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. + + Register an object renderer for a specific source type. + This renderer will be returned from a call to + specifying the same as an argument. - + - Produces a formatted string as specified by the conversion pattern. + Get the default renderer instance - the event being logged - The TextWriter to write the formatted event to + the default renderer - Parse the using the patter format - specified in the property. + Get the default renderer - + - Add a converter to this PatternLayout + Interface implemented by logger repository plugins. - the converter info - This version of the method is used by the configurator. - Programmatic users should use the alternative method. + Plugins define additional behavior that can be associated + with a . + The held by the + property is used to store the plugins for a repository. + + + The log4net.Config.PluginAttribute can be used to + attach plugins to repositories created using configuration + attributes. + Nicko Cadell + Gert Driesen - + - Add a converter to this PatternLayout + Attaches the plugin to the specified . - the name of the conversion pattern for this converter - the type of the converter + The that this plugin should be attached to. - Add a named pattern converter to this instance. This - converter will be used in the formatting of the event. - This method must be called before . + A plugin may only be attached to a single repository. - The specified must extend the - type. + This method is called when the plugin is attached to the repository. - + - The pattern formatting string + Is called when the plugin is to shutdown. - The ConversionPattern option. This is the string which - controls formatting and consists of a mix of literal content and - conversion specifiers. + This method is called to notify the plugin that + it should stop operating and should detach from + the repository. - + - Wrapper class used to map converter names to converter types + Gets the name of the plugin. + + The name of the plugin. + - Pattern converter info class used during configuration to - pass to the - method. + Plugins are stored in the + keyed by name. Each plugin instance attached to a + repository must be a unique name. - + - default constructor + A strongly-typed collection of objects. + Nicko Cadell - + - Gets or sets the name of the conversion pattern + Creates a read-only wrapper for a PluginCollection instance. - - - The name of the pattern in the format string - - + list to create a readonly wrapper arround + + A PluginCollection wrapper that is read-only. + - + - Gets or sets the type of the converter + Initializes a new instance of the PluginCollection class + that is empty and has the default initial capacity. - - - The value specified must extend the - type. - - - + - Type converter for the interface + Initializes a new instance of the PluginCollection class + that has the specified initial capacity. - - - Used to convert objects to the interface. - Supports converting from the interface to - the interface using the . - - - Nicko Cadell - Gert Driesen + + The number of elements that the new PluginCollection is initially capable of storing. + - + - Interface supported by type converters + Initializes a new instance of the PluginCollection class + that contains elements copied from the specified PluginCollection. - - - This interface supports conversion from arbitrary types - to a single target type. See . - - - Nicko Cadell - Gert Driesen + The PluginCollection whose elements are copied to the new collection. - + - Can the source type be converted to the type supported by this object + Initializes a new instance of the PluginCollection class + that contains elements copied from the specified array. - the type to convert - true if the conversion is possible - - - Test if the can be converted to the - type supported by this converter. - - + The array whose elements are copied to the new list. - + - Convert the source object to the type supported by this object + Initializes a new instance of the PluginCollection class + that contains elements copied from the specified collection. - the object to convert - the converted object - - - Converts the to the type supported - by this converter. - - + The collection whose elements are copied to the new list. - + - Can the sourceType be converted to an + Allow subclasses to avoid our default constructors - the source to be to be converted - true if the source type can be converted to - - - Test if the can be converted to a - . Only is supported - as the . - - + + + + + + Copies the entire PluginCollection to a one-dimensional + array. + + The one-dimensional array to copy to. + + + + Copies the entire PluginCollection 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 PluginCollection. + + The to be added to the end of the PluginCollection. + The index at which the value has been added. + + + + Removes all elements from the PluginCollection. + + + + + Creates a shallow copy of the . + + A new with a shallow copy of the collection data. + + + + Determines whether a given is in the PluginCollection. + + The to check for. + true if is found in the PluginCollection; otherwise, false. + + + + Returns the zero-based index of the first occurrence of a + in the PluginCollection. + + The to locate in the PluginCollection. + + The zero-based index of the first occurrence of + in the entire PluginCollection, if found; otherwise, -1. + + + + + Inserts an element into the PluginCollection 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 PluginCollection. + + The to remove from the PluginCollection. + + The specified was not found in the PluginCollection. + + + + + Removes the element at the specified index of the PluginCollection. + + 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 PluginCollection. + + An for the entire PluginCollection. + + + + Adds the elements of another PluginCollection to the current PluginCollection. + + The PluginCollection whose elements should be added to the end of the current PluginCollection. + The new of the PluginCollection. - + - Convert the value to a object + Adds the elements of a array to the current PluginCollection. - the value to convert - the object - - - Convert the object to a - object. If the object - is a then the - is used to adapt between the two interfaces, otherwise an - exception is thrown. - - + The array whose elements should be added to the end of the PluginCollection. + The new of the PluginCollection. - + - Extract the value of a property from the + Adds the elements of a collection to the current PluginCollection. - - - Extract the value of a property from the - - - Nicko Cadell + The collection whose elements should be added to the end of the PluginCollection. + The new of the PluginCollection. - + - Constructs a RawPropertyLayout + 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 . + + + - Lookup the property for + Gets the number of elements actually contained in the PluginCollection. - The event to format - returns property value - - - Looks up and returns the object value of the property - named . If there is no property defined - with than name then null will be returned. - - - + - The name of the value to lookup in the LoggingEvent Properties collection. + 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. - Value to lookup in the LoggingEvent Properties collection + An object that can be used to synchronize access to the collection. - - - String name of the property to lookup in the . - - - + - Extract the date from the + Gets or sets the at the specified index. - - - Extract the date from the - - - Nicko Cadell - Gert Driesen + + 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 . + - + - Constructs a RawTimeStampLayout + 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 the as a . + Gets a value indicating whether the IList is read-only. - The event to format - returns the time stamp - - - Gets the as a . - - - The time stamp is in local time. To format the time stamp - in universal time use . - - + true if the collection is read-only; otherwise, false. The default is false. - + - Extract the date from the + Gets or sets the number of elements the PluginCollection can contain. - - - Extract the date from the - - - Nicko Cadell - Gert Driesen + + The number of elements the PluginCollection can contain. + - + - Constructs a RawUtcTimeStampLayout + Supports type-safe iteration over a . + - + - Gets the as a . + Advances the enumerator to the next element in the collection. - The event to format - returns the time stamp - - - Gets the as a . - - - The time stamp is in universal time. To format the time stamp - in local time use . - - + + 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. + - + - A very simple layout + Sets the enumerator to its initial position, before the first element in the collection. - - - SimpleLayout consists of the level of the log statement, - followed by " - " and then the log message itself. For example, - - DEBUG - Hello world - - - - Nicko Cadell - Gert Driesen - + - Constructs a SimpleLayout + Gets the current element in the collection. - + - Initialize layout options + Type visible only to our subclasses + Used to access protected constructor - - - 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. - - + - + - Produces a simple formatted output. + A value - the event being logged - The TextWriter to write the formatted event to - - - Formats the event as the level of the even, - followed by " - " and then the log message itself. The - output is terminated by a newline. - - - - - Layout that formats the log events as XML elements. - - - - The output of the consists of a series of - log4net:event elements. It does not output a complete well-formed XML - file. The output is designed to be included as an external entity - in a separate file to form a correct XML file. - - - For example, if abc is the name of the file where - the output goes, then a well-formed XML file would - be: - - - <?xml version="1.0" ?> - - <!DOCTYPE log4net:events SYSTEM "log4net-events.dtd" [<!ENTITY data SYSTEM "abc">]> - - <log4net:events version="1.2" xmlns:log4net="http://logging.apache.org/log4net/schemas/log4net-events-1.2> - &data; - </log4net:events> - - - This approach enforces the independence of the - and the appender where it is embedded. - - - The version attribute helps components to correctly - interpret output generated by . The value of - this attribute should be "1.2" for release 1.2 and later. - - - Alternatively the Header and Footer properties can be - configured to output the correct XML header, open tag and close tag. - When setting the Header and Footer properties it is essential - that the underlying data store not be appendable otherwise the data - will become invalid XML. - - - Nicko Cadell - Gert Driesen + + + Supports simple iteration over a . + + - + - Layout that formats the log events as XML elements. + 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. + + + The current element in the collection. + + + + + + + + Map of repository plugins. - This is an abstract class that must be subclassed by an implementation - to conform to a specific schema. - - - Deriving classes must implement the method. + This class is a name keyed map of the plugins that are + attached to a repository. Nicko Cadell Gert Driesen - + - Protected constructor to support subclasses + Constructor + The repository that the plugins should be attached to. - Initializes a new instance of the class - with no location info. + Initialize a new instance of the class with a + repository that the plugins should be attached to. - + - Protected constructor to support subclasses + Adds a to the map. + The to add to the map. - The parameter determines whether - location information will be output by the layout. If - is set to true, then the - file name and line number of the statement at the origin of the log - statement will be output. + The will be attached to the repository when added. - If you are embedding this layout within an SMTPAppender - then make sure to set the LocationInfo option of that - appender as well. + If there already exists a plugin with the same name + attached to the repository then the old plugin will + be and replaced with + the new plugin. - + - Initialize layout options + Removes a from the map. + The to remove from the map. - 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. + Remove a specific plugin from this map. - + - Produces a formatted string. + Gets a by name. - The event being logged. - The TextWriter to write the formatted event to + The name of the to lookup. + + The from the map with the name specified, or + null if no plugin is found. + - Format the and write it to the . - - - This method creates an that writes to the - . The is passed - to the method. Subclasses should override the - method rather than this method. + Lookup a plugin by name. If the plugin is not found null + will be returned. - + - Does the actual writing of the XML. + Gets all possible plugins as a list of objects. - The writer to use to output the event to. - The event to write. + All possible plugins as a list of objects. - Subclasses should override this method to format - the as XML. + Get a collection of all the plugins defined in this map. - - - Flag to indicate if location information should be included in - the XML events. - - - + - Writer adapter that ignores Close + Base implementation of + + + Default abstract implementation of the + interface. This base class can be used by implementors + of the interface. + + + Nicko Cadell + Gert Driesen - + - The string to replace invalid chars with + Constructor + the name of the plugin + + Initializes a new Plugin with the specified name. + - + - Gets a value indicating whether to include location information in - the XML events. + Attaches this plugin to a . - - true if location information should be included in the XML - events; otherwise, false. - + The that this plugin should be attached to. - If is set to true, then the file - name and line number of the statement at the origin of the log - statement will be output. + A plugin may only be attached to a single repository. - If you are embedding this layout within an SMTPAppender - then make sure to set the LocationInfo option of that - appender as well. + This method is called when the plugin is attached to the repository. - + - The string to replace characters that can not be expressed in XML with. + Is called when the plugin is to shutdown. + - Not all characters may be expressed in XML. This property contains the - string to replace those that can not with. This defaults to a ?. Set it - to the empty string to simply remove offending characters. For more - details on the allowed character ranges see http://www.w3.org/TR/REC-xml/#charsets - Character replacement will occur in the log message, the property names - and the property values. + This method is called to notify the plugin that + it should stop operating and should detach from + the repository. -
- + - Gets the content type output by this layout. + The name of this plugin. - - As this is the XML layout, the value is always "text/xml". - - - - As this is the XML layout, the value is always "text/xml". - - - + - Constructs an XmlLayout + The repository this plugin is attached to. - + - Constructs an XmlLayout. + Gets or sets the name of the plugin. + + The name of the plugin. + - The LocationInfo option takes a boolean value. By - default, it is set to false which means there will be no location - information output by this layout. If the the option is set to - true, then the file name and line number of the statement - at the origin of the log statement will be output. + Plugins are stored in the + keyed by name. Each plugin instance attached to a + repository must be a unique name. - If you are embedding this layout within an SmtpAppender - then make sure to set the LocationInfo option of that - appender as well. + The name of the plugin must not change one the + plugin has been attached to a repository. - + - Initialize layout options + The repository for this plugin + + The that this plugin is attached to. + - 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. - - - Builds a cache of the element names + Gets or sets the that this plugin is + attached to. - + - Does the actual writing of the XML. + Plugin that listens for events from the - The writer to use to output the event to. - The event to write. - Override the base class method - to write the to the . + This plugin publishes an instance of + on a specified . This listens for logging events delivered from + a remote . + + + When an event is received it is relogged within the attached repository + as if it had been raised locally. + Nicko Cadell + Gert Driesen - - - The prefix to use for all generated element names - - - + - The prefix to use for all element names + Default constructor - The default prefix is log4net. Set this property - to change the prefix. If the prefix is set to an empty string - then no prefix will be written. + Initializes a new instance of the class. + + + The property must be set. - + - Set whether or not to base64 encode the message. + Construct with sink Uri. + The name to publish the sink under in the remoting infrastructure. + See for more details. - By default the log message will be written as text to the xml - output. This can cause problems when the message contains binary - data. By setting this to true the contents of the message will be - base64 encoded. If this is set then invalid character replacement - (see ) will not be performed - on the log message. + Initializes a new instance of the class + with specified name. - + - Set whether or not to base64 encode the property values. + Attaches this plugin to a . + The that this plugin should be attached to. - By default the properties will be written as text to the xml - output. This can cause problems when one or more properties contain - binary data. By setting this to true the values of the properties - will be base64 encoded. If this is set then invalid character replacement - (see ) will not be performed - on the property values. + A plugin may only be attached to a single repository. + + + This method is called when the plugin is attached to the repository. - + - Layout that formats the log events as XML elements compatible with the log4j schema + Is called when the plugin is to shutdown. - Formats the log events according to the http://logging.apache.org/log4j schema. + When the plugin is shutdown the remote logging + sink is disconnected. - Nicko Cadell - + - The 1st of January 1970 in UTC + The fully qualified type of the RemoteLoggingServerPlugin class. + + Used by the internal logger to record the Type of the + log message. + - + - Constructs an XMLLayoutSchemaLog4j + Gets or sets the URI of this sink. + + The URI of this sink. + + + + This is the name under which the object is marshaled. + + + - + - Constructs an XMLLayoutSchemaLog4j. + Delivers objects to a remote sink. - The LocationInfo option takes a boolean value. By - default, it is set to false which means there will be no location - information output by this layout. If the the option is set to - true, then the file name and line number of the statement - at the origin of the log statement will be output. - - - If you are embedding this layout within an SMTPAppender - then make sure to set the LocationInfo option of that - appender as well. + Internal class used to listen for logging events + and deliver them to the local repository. - + - Actually do the writing of the xml + Constructor - the writer to use - the event to write + The repository to log to. - Generate XML that is compatible with the log4j schema. + Initializes a new instance of the for the + specified . - + - The version of the log4j schema to use. + Logs the events to the repository. + The events to log. - Only version 1.2 of the log4j schema is supported. + The events passed are logged to the - + - The default object Renderer. + Obtains a lifetime service object to control the lifetime + policy for this instance. + null to indicate that this instance should live forever. - The default renderer supports rendering objects and collections to strings. - - - See the method for details of the output. + Obtains a lifetime service object to control the lifetime + policy for this instance. This object should live forever + therefore this implementation returns null. - Nicko Cadell - Gert Driesen - + - Implement this interface in order to render objects as strings + The underlying that events should + be logged to. + + + + + Default implementation of - Certain types require special case conversion to - string form. This conversion is done by an object renderer. - Object renderers implement the - interface. + This default implementation of the + interface is used to create the default subclass + of the object. Nicko Cadell Gert Driesen - + - Render the object to a string + Interface abstracts creation of instances - The map used to lookup renderers - The object to render - The writer to render to - Render the object to a - string. + This interface is used by the to + create new objects. - The parameter is - provided to lookup and render other objects. This is - very useful where contains - nested objects of unknown type. The - method can be used to render these objects. + The method is called + to create a named . - - - - - Default constructor - - - Default constructor + Implement this interface to create new subclasses of . + Nicko Cadell + Gert Driesen - + - Render the object to a string + Create a new instance - The map used to lookup renderers - The object to render - The writer to render to + The that will own the . + The name of the . + The instance for the specified name. - Render the object to a string. + Create a new instance with the + specified name. - The parameter is - provided to lookup and render other objects. This is - very useful where contains - nested objects of unknown type. The - method can be used to render these objects. + Called by the to create + new named instances. - The default renderer supports rendering objects to strings as follows: + If the is null then the root logger + must be returned. - - - Value - Rendered String - - - null - - "(null)" - - - - - - - For a one dimensional array this is the - array type name, an open brace, followed by a comma - separated list of the elements (using the appropriate - renderer), followed by a close brace. - - - For example: int[] {1, 2, 3}. - - - If the array is not one dimensional the - Array.ToString() is returned. - - - - - , & - - - Rendered as an open brace, followed by a comma - separated list of the elements (using the appropriate - renderer), followed by a close brace. - - - For example: {a, b, c}. - - - All collection classes that implement its subclasses, - or generic equivalents all implement the interface. - - - - - - - - Rendered as the key, an equals sign ('='), and the value (using the appropriate - renderer). - - - For example: key=value. - - - - - other - - Object.ToString() - - - - + - Render the array argument into a string - - The map used to lookup renderers - the array to render - The writer to render to - - - For a one dimensional array this is the - array type name, an open brace, followed by a comma - separated list of the elements (using the appropriate - renderer), followed by a close brace. For example: - int[] {1, 2, 3}. - + Default constructor +
+ - If the array is not one dimensional the - Array.ToString() is returned. + Initializes a new instance of the class.
- + - Render the enumerator argument into a string + Create a new instance - The map used to lookup renderers - the enumerator to render - The writer to render to + The that will own the . + The name of the . + The instance for the specified name. - Rendered as an open brace, followed by a comma - separated list of the elements (using the appropriate - renderer), followed by a close brace. For example: - {a, b, c}. + Create a new instance with the + specified name. + + + Called by the to create + new named instances. + + + If the is null then the root logger + must be returned. - + - Render the DictionaryEntry argument into a string + Default internal subclass of - The map used to lookup renderers - the DictionaryEntry to render - The writer to render to - Render the key, an equals sign ('='), and the value (using the appropriate - renderer). For example: key=value. + This subclass has no additional behavior over the + class but does allow instances + to be created. - + - Map class objects to an . + Implementation of used by - Maintains a mapping between types that require special - rendering and the that - is used to render them. + Internal class used to provide implementation of + interface. Applications should use to get + logger instances. - The method is used to render an - object using the appropriate renderers defined in this map. + This is one of the central classes in the log4net implementation. One of the + distinctive features of log4net are hierarchical loggers and their + evaluation. The organizes the + instances into a rooted tree hierarchy. + + + The class is abstract. Only concrete subclasses of + can be created. The + is used to create instances of this type for the . Nicko Cadell Gert Driesen + Aspi Havewala + Douglas de la Torre - + - Default Constructor + This constructor created a new instance and + sets its name. + The name of the . - Default constructor. + This constructor is protected and designed to be used by + a subclass that is not abstract. + + + Loggers are constructed by + objects. See for the default + logger creator. - + - Render using the appropriate renderer. + Add to the list of appenders of this + Logger instance. - the object to render to a string - the object rendered as a string + An appender to add to this logger - This is a convenience method used to render an object to a string. - The alternative method - should be used when streaming output to a . + Add to the list of appenders of this + Logger instance. + + + If is already in the list of + appenders, then it won't be added again. - + - Render using the appropriate renderer. + Look for the appender named as name - the object to render to a string - The writer to render to + The name of the appender to lookup + The appender with the name specified, or null. - Find the appropriate renderer for the type of the - parameter. This is accomplished by calling the - method. Once a renderer is found, it is - applied on the object and the result is returned - as a . + Returns the named appender, or null if the appender is not found. - + - Gets the renderer for the specified object type + Remove all previously added appenders from this Logger instance. - the object to lookup the renderer for - the renderer for - - Gets the renderer for the specified object type. - - - Syntactic sugar method that calls - with the type of the object parameter. - + + Remove all previously added appenders from this Logger instance. + + + This is useful when re-reading configuration information. + - + - Gets the renderer for the specified type + Remove the appender passed as parameter form the list of appenders. - the type to lookup the renderer for - the renderer for the specified type + The appender to remove + The appender removed from the list - Returns the renderer for the specified type. - If no specific renderer has been defined the - will be returned. + Remove the appender passed as parameter form the list of appenders. + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. - - - Internal function to recursively search interfaces - - the type to lookup the renderer for - the renderer for the specified type - - + - Clear the map of renderers + Remove the appender passed as parameter form the list of appenders. + The name of the appender to remove + The appender removed from the list - Clear the custom renderers defined by using - . The - cannot be removed. + Remove the named appender passed as parameter form the list of appenders. + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. - + - Register an for . + This generic form is intended to be used by wrappers. - the type that will be rendered by - the renderer for + 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. - Register an object renderer for a specific source type. - This renderer will be returned from a call to - specifying the same as an argument. + Generate a logging event for the specified using + the and . + + + This method must not throw any exception to the caller. - + - Get the default renderer instance + This is the most generic printing method that is intended to be used + by wrappers. - the default renderer + The event being logged. - Get the default renderer + Logs the specified logging event through this logger. + + + This method must not throw any exception to the caller. - + - Interface implemented by logger repository plugins. + 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. + - Plugins define additional behavior that can be associated - with a . - The held by the - property is used to store the plugins for a repository. + Test if this logger is going to log events of the specified . - The log4net.Config.PluginAttribute can be used to - attach plugins to repositories created using configuration - attributes. + This method must not throw any exception to the caller. - Nicko Cadell - Gert Driesen - + - Attaches the plugin to the specified . + Deliver the to the attached appenders. - The that this plugin should be attached to. + The event to log. - A plugin may only be attached to a single repository. + Call the appenders in the hierarchy starting at + this. If no appenders could be found, emit a + warning. - This method is called when the plugin is attached to the repository. + This method calls all the appenders inherited from the + hierarchy circumventing any evaluation of whether to log or not + to log the particular log request. - + - Is called when the plugin is to shutdown. + Closes all attached appenders implementing the interface. - This method is called to notify the plugin that - it should stop operating and should detach from - the repository. + Used to ensure that the appenders are correctly shutdown. - + - Gets the name of the plugin. + This is the most generic printing method. This generic form is intended to be used by wrappers - - The name of the plugin. - + The level of the message to be logged. + The message object to log. + The exception to log, including its stack trace. - Plugins are stored in the - keyed by name. Each plugin instance attached to a - repository must be a unique name. + Generate a logging event for the specified using + the . - + - A strongly-typed collection of objects. + Creates a new logging event and logs the event without further checks. - Nicko Cadell + 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. + + + Generates a logging event and delivers it to the attached + appenders. + + - + - Creates a read-only wrapper for a PluginCollection instance. + Creates a new logging event and logs the event without further checks. - list to create a readonly wrapper arround - - A PluginCollection wrapper that is read-only. - + The event being logged. + + + Delivers the logging event to the attached appenders. + + - + - Initializes a new instance of the PluginCollection class - that is empty and has the default initial capacity. + The fully qualified type of the Logger class. - + - Initializes a new instance of the PluginCollection class - that has the specified initial capacity. + The name of this logger. - - The number of elements that the new PluginCollection is initially capable of storing. - - + - Initializes a new instance of the PluginCollection class - that contains elements copied from the specified PluginCollection. + The assigned level of this logger. - The PluginCollection whose elements are copied to the new collection. + + + The level variable need not be + assigned a value in which case it is inherited + form the hierarchy. + + - + - Initializes a new instance of the PluginCollection class - that contains elements copied from the specified array. + The parent of this logger. - The array whose elements are copied to the new list. + + + The parent of this logger. + All loggers have at least one ancestor which is the root logger. + + - + - Initializes a new instance of the PluginCollection class - that contains elements copied from the specified collection. + Loggers need to know what Hierarchy they are in. - The collection whose elements are copied to the new list. + + + Loggers need to know what Hierarchy they are in. + The hierarchy that this logger is a member of is stored + here. + + - + - Allow subclasses to avoid our default constructors + Helper implementation of the interface - - - + - Copies the entire PluginCollection to a one-dimensional - array. + Flag indicating if child loggers inherit their parents appenders - The one-dimensional array to copy to. + + + Additivity is set to true by default, that is children inherit + the appenders of their ancestors by default. If this variable is + set to false then the appenders found in the + ancestors of this logger are not used. However, the children + of this logger will inherit its appenders, unless the children + have their additivity flag set to false too. See + the user manual for more details. + + - + - Copies the entire PluginCollection to a one-dimensional - array, starting at the specified index of the target array. + Lock to protect AppenderAttachedImpl variable m_appenderAttachedImpl - The one-dimensional array to copy to. - The zero-based index in at which copying begins. - + - Adds a to the end of the PluginCollection. + Gets or sets the parent logger in the hierarchy. - The to be added to the end of the PluginCollection. - The index at which the value has been added. + + The parent logger in the hierarchy. + + + + Part of the Composite pattern that makes the hierarchy. + The hierarchy is parent linked rather than child linked. + + - + - Removes all elements from the PluginCollection. + Gets or sets a value indicating if child loggers inherit their parent's appenders. + + true if child loggers inherit their parent's appenders. + + + + Additivity is set to true by default, that is children inherit + the appenders of their ancestors by default. If this variable is + set to false then the appenders found in the + ancestors of this logger are not used. However, the children + of this logger will inherit its appenders, unless the children + have their additivity flag set to false too. See + the user manual for more details. + + - + - Creates a shallow copy of the . + Gets the effective level for this logger. - A new with a shallow copy of the collection data. + The nearest level in the logger hierarchy. + + + Starting from this logger, searches the logger hierarchy for a + non-null level and returns it. Otherwise, returns the level of the + root logger. + + The Logger class is designed so that this method executes as + quickly as possible. + - + - Determines whether a given is in the PluginCollection. + Gets or sets the where this + Logger instance is attached to. - The to check for. - true if is found in the PluginCollection; otherwise, false. + The hierarchy that this logger belongs to. + + + This logger must be attached to a single . + + - + - Returns the zero-based index of the first occurrence of a - in the PluginCollection. + Gets or sets the assigned , if any, for this Logger. - The to locate in the PluginCollection. - - The zero-based index of the first occurrence of - in the entire PluginCollection, if found; otherwise, -1. - + + The of this logger. + + + + The assigned can be null. + + - + - Inserts an element into the PluginCollection at the specified index. + Get the appenders contained in this logger as an + . - The zero-based index at which should be inserted. - The to insert. - - is less than zero - -or- - is equal to or greater than . - + A collection of the appenders in this logger + + + Get the appenders contained in this logger as an + . If no appenders + can be found, then a is returned. + + - + - Removes the first occurrence of a specific from the PluginCollection. + Gets the logger name. - The to remove from the PluginCollection. - - The specified was not found in the PluginCollection. - + + The name of the logger. + + + + The name of this logger + + - + - Removes the element at the specified index of the PluginCollection. + Gets the where this + Logger instance is attached to. - The zero-based index of the element to remove. - - is less than zero. - -or- - is equal to or greater than . - + + The that this logger belongs to. + + + + Gets the where this + Logger instance is attached to. + + - + - Returns an enumerator that can iterate through the PluginCollection. + Construct a new Logger - An for the entire PluginCollection. + the name of the logger + + + Initializes a new instance of the class + with the specified name. + + - + - Adds the elements of another PluginCollection to the current PluginCollection. + Delegate used to handle logger creation event notifications. - The PluginCollection whose elements should be added to the end of the current PluginCollection. - The new of the PluginCollection. + The in which the has been created. + The event args that hold the instance that has been created. + + + Delegate used to handle logger creation event notifications. + + - + - Adds the elements of a array to the current PluginCollection. + Provides data for the event. - The array whose elements should be added to the end of the PluginCollection. - The new of the PluginCollection. + + + A event is raised every time a + is created. + + - + - Adds the elements of a collection to the current PluginCollection. + The created - The collection whose elements should be added to the end of the PluginCollection. - The new of the PluginCollection. - + - Sets the capacity to the actual number of elements. + Constructor + The that has been created. + + + Initializes a new instance of the event argument + class,with the specified . + + - - - 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 PluginCollection. + Gets the that has been created. + + The that has been created. + + + + The that has been created. + + - + - Gets a value indicating whether access to the collection is synchronized (thread-safe). + Hierarchical organization of loggers - true if access to the ICollection is synchronized (thread-safe); otherwise, false. + + + The casual user should not have to deal with this class + directly. + + + This class is specialized in retrieving loggers by name and + also maintaining the logger hierarchy. Implements the + interface. + + + The structure of the logger hierarchy is maintained by the + method. The hierarchy is such that children + link to their parent but parents do not have any references to their + children. Moreover, loggers can be instantiated in any order, in + particular descendant before ancestor. + + + In case a descendant is created before a particular ancestor, + then it creates a provision node for the ancestor and adds itself + to the provision node. Other descendants of the same ancestor add + themselves to the previously created provision node. + + + Nicko Cadell + Gert Driesen - + - Gets an object that can be used to synchronize access to the collection. + Base implementation of - - An object that can be used to synchronize access to the collection. - + + + Default abstract implementation of the interface. + + + Skeleton implementation of the interface. + All types can extend this type. + + + Nicko Cadell + Gert Driesen - + - Gets or sets the at the specified index. + Interface implemented by logger repositories. - - 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 . - + + + This interface is implemented by logger repositories. e.g. + . + + + This interface is used by the + to obtain interfaces. + + + Nicko Cadell + Gert Driesen - + - Gets a value indicating whether the collection has a fixed size. + Check if the named logger exists in the repository. If so return + its reference, otherwise returns null. - true if the collection has a fixed size; otherwise, false. The default is false. + The name of the logger to lookup + The Logger object with the name specified + + + If the names logger exists it is returned, otherwise + null is returned. + + - + - Gets a value indicating whether the IList is read-only. + Returns all the currently defined loggers as an Array. - true if the collection is read-only; otherwise, false. The default is false. + All the defined loggers + + + Returns all the currently defined loggers as an Array. + + - + - Gets or sets the number of elements the PluginCollection can contain. + Returns a named logger instance - - The number of elements the PluginCollection can contain. - + The name of the logger to retrieve + The logger object with the name specified + + + Returns a named logger instance. + + + If a logger of that name already exists, then it will be + returned. Otherwise, a new logger will be instantiated and + then linked with its existing ancestors as well as children. + + - + + Shutdown the repository + + + Shutting down a repository will safely close and remove + all appenders in all loggers including the root logger. + + + Some appenders need to be closed before the + application exists. Otherwise, pending logging events might be + lost. + + + The method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. + + + + - Supports type-safe iteration over a . + Reset the repositories configuration to a default state - + + + Reset all values contained in this instance to their + default state. + + + Existing loggers are not removed. They are just reset. + + + This method should be used sparingly and with care as it will + block all logging until it is completed. + + - + - Advances the enumerator to the next element in the collection. + Log the through this repository. - - 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. - + the event to log + + + This method should not normally be used to log. + The interface should be used + for routine logging. This interface can be obtained + using the method. + + + The logEvent is delivered to the appropriate logger and + that logger is then responsible for logging the event. + + - + - Sets the enumerator to its initial position, before the first element in the collection. + Returns all the Appenders that are configured as an Array. + All the Appenders + + + Returns all the Appenders that are configured as an Array. + + - + - Gets the current element in the collection. + The name of the repository + + The name of the repository + + + + The name of the repository. + + - + - Type visible only to our subclasses - Used to access protected constructor + RendererMap accesses the object renderer map for this repository. - + + RendererMap accesses the object renderer map for this repository. + + + + RendererMap accesses the object renderer map for this repository. + + + The RendererMap holds a mapping between types and + objects. + + - + - A value + The plugin map for this repository. + + The plugin map for this repository. + + + + The plugin map holds the instances + that have been attached to this repository. + + - + - Supports simple iteration over a . + Get the level map for the Repository. - + + + Get the level map for the Repository. + + + The level map defines the mappings between + level names and objects in + this repository. + + - + - Initializes a new instance of the Enumerator class. + The threshold for all events in this repository - + + The threshold for all events in this repository + + + + The threshold for all events in this repository. + + - + - Advances the enumerator to the next element in the collection. + Flag indicates if this repository has been configured. - - 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. - + + Flag indicates if this repository has been configured. + + + + Flag indicates if this repository has been configured. + + - + - Sets the enumerator to its initial position, before the first element in the collection. + Collection of internal messages captured during the most + recent configuration process. - + - Gets the current element in the collection. + Event to notify that the repository has been shutdown. - The current element in the collection. + Event to notify that the repository has been shutdown. - - - - - - - Map of repository plugins. - - This class is a name keyed map of the plugins that are - attached to a repository. + Event raised when the repository has been shutdown. - Nicko Cadell - Gert Driesen - + - Constructor + Event to notify that the repository has had its configuration reset. - The repository that the plugins should be attached to. + + Event to notify that the repository has had its configuration reset. + - Initialize a new instance of the class with a - repository that the plugins should be attached to. + Event raised when the repository's configuration has been + reset to default. - + - Adds a to the map. + Event to notify that the repository has had its configuration changed. - The to add to the map. + + Event to notify that the repository has had its configuration changed. + - The will be attached to the repository when added. - - - If there already exists a plugin with the same name - attached to the repository then the old plugin will - be and replaced with - the new plugin. + Event raised when the repository's configuration has been changed. - + - Removes a from the map. + Repository specific properties - The to remove from the map. + + Repository specific properties + - Remove a specific plugin from this map. + These properties can be specified on a repository specific basis. - + - Gets a by name. + Default Constructor - The name of the to lookup. - - The from the map with the name specified, or - null if no plugin is found. - - Lookup a plugin by name. If the plugin is not found null - will be returned. + Initializes the repository with default (empty) properties. - + - Gets all possible plugins as a list of objects. + Construct the repository using specific properties - All possible plugins as a list of objects. + the properties to set for this repository - Get a collection of all the plugins defined in this map. + Initializes the repository with specified properties. - + - Base implementation of + Test if logger exists + The name of the logger to lookup + The Logger object with the name specified - Default abstract implementation of the - interface. This base class can be used by implementors - of the interface. + Check if the named logger exists in the repository. If so return + its reference, otherwise returns null. - Nicko Cadell - Gert Driesen - + - Constructor + Returns all the currently defined loggers in the repository - the name of the plugin + All the defined loggers - Initializes a new Plugin with the specified name. + + Returns all the currently defined loggers in the repository as an Array. + - + - Attaches this plugin to a . + Return a new logger instance - The that this plugin should be attached to. + The name of the logger to retrieve + The logger object with the name specified - A plugin may only be attached to a single repository. + Return a new logger instance. - This method is called when the plugin is attached to the repository. + If a logger of that name already exists, then it will be + returned. Otherwise, a new logger will be instantiated and + then linked with its existing ancestors as well as children. - + - Is called when the plugin is to shutdown. + Shutdown the repository - This method is called to notify the plugin that - it should stop operating and should detach from - the repository. + Shutdown the repository. Can be overridden in a subclass. + This base class implementation notifies the + listeners and all attached plugins of the shutdown event. - + - The name of this plugin. + Reset the repositories configuration to a default state + + + Reset all values contained in this instance to their + default state. + + + Existing loggers are not removed. They are just reset. + + + This method should be used sparingly and with care as it will + block all logging until it is completed. + + - + - The repository this plugin is attached to. + Log the logEvent through this repository. + the event to log + + + This method should not normally be used to log. + The interface should be used + for routine logging. This interface can be obtained + using the method. + + + The logEvent is delivered to the appropriate logger and + that logger is then responsible for logging the event. + + - + - Gets or sets the name of the plugin. + Returns all the Appenders that are configured as an Array. - - The name of the plugin. - + All the Appenders - Plugins are stored in the - keyed by name. Each plugin instance attached to a - repository must be a unique name. - - - The name of the plugin must not change one the - plugin has been attached to a repository. + Returns all the Appenders that are configured as an Array. - + + + The fully qualified type of the LoggerRepositorySkeleton class. + + + Used by the internal logger to record the Type of the + log message. + + + - The repository for this plugin + Adds an object renderer for a specific class. - - The that this plugin is attached to. - + The type that will be rendered by the renderer supplied. + The object renderer used to render the object. - Gets or sets the that this plugin is - attached to. + Adds an object renderer for a specific class. - + - Plugin that listens for events from the + Notify the registered listeners that the repository is shutting down + Empty EventArgs - This plugin publishes an instance of - on a specified . This listens for logging events delivered from - a remote . - - - When an event is received it is relogged within the attached repository - as if it had been raised locally. + Notify any listeners that this repository is shutting down. - Nicko Cadell - Gert Driesen - + - Default constructor + Notify the registered listeners that the repository has had its configuration reset + Empty EventArgs - Initializes a new instance of the class. - - - The property must be set. + Notify any listeners that this repository's configuration has been reset. - + - Construct with sink Uri. + Notify the registered listeners that the repository has had its configuration changed - The name to publish the sink under in the remoting infrastructure. - See for more details. + Empty EventArgs - Initializes a new instance of the class - with specified name. + Notify any listeners that this repository's configuration has changed. - + - Attaches this plugin to a . + Raise a configuration changed event on this repository - The that this plugin should be attached to. + EventArgs.Empty - A plugin may only be attached to a single repository. - - - This method is called when the plugin is attached to the repository. + Applications that programmatically change the configuration of the repository should + raise this event notification to notify listeners. - + - Is called when the plugin is to shutdown. + The name of the repository + + The string name of the repository + - When the plugin is shutdown the remote logging - sink is disconnected. + The name of this repository. The name is + used to store and lookup the repositories + stored by the . - + - Gets or sets the URI of this sink. + The threshold for all events in this repository - The URI of this sink. + The threshold for all events in this repository - This is the name under which the object is marshaled. - + The threshold for all events in this repository - + - Delivers objects to a remote sink. + RendererMap accesses the object renderer map for this repository. + + RendererMap accesses the object renderer map for this repository. + - Internal class used to listen for logging events - and deliver them to the local repository. + RendererMap accesses the object renderer map for this repository. + + + The RendererMap holds a mapping between types and + objects. - + - Constructor + The plugin map for this repository. - The repository to log to. + + The plugin map for this repository. + - Initializes a new instance of the for the - specified . + The plugin map holds the instances + that have been attached to this repository. - + - Logs the events to the repository. + Get the level map for the Repository. - The events to log. - The events passed are logged to the + Get the level map for the Repository. + + + The level map defines the mappings between + level names and objects in + this repository. - + - Obtains a lifetime service object to control the lifetime - policy for this instance. + Flag indicates if this repository has been configured. - null to indicate that this instance should live forever. + + Flag indicates if this repository has been configured. + - Obtains a lifetime service object to control the lifetime - policy for this instance. This object should live forever - therefore this implementation returns null. + Flag indicates if this repository has been configured. - + - The underlying that events should - be logged to. + Contains a list of internal messages captures during the + last configuration. - + - Default implementation of + Event to notify that the repository has been shutdown. + + Event to notify that the repository has been shutdown. + - This default implementation of the - interface is used to create the default subclass - of the object. + Event raised when the repository has been shutdown. - Nicko Cadell - Gert Driesen - + - Interface abstracts creation of instances + Event to notify that the repository has had its configuration reset. + + Event to notify that the repository has had its configuration reset. + - This interface is used by the to - create new objects. - - - The method is called - to create a named . - - - Implement this interface to create new subclasses of . + Event raised when the repository's configuration has been + reset to default. - Nicko Cadell - Gert Driesen - + - Create a new instance + Event to notify that the repository has had its configuration changed. - The name of the . - The instance for the specified name. + + Event to notify that the repository has had its configuration changed. + - Create a new instance with the - specified name. - - - Called by the to create - new named instances. - - - If the is null then the root logger - must be returned. + Event raised when the repository's configuration has been changed. - + - Default constructor + Repository specific properties + + Repository specific properties + - - Initializes a new instance of the class. - + These properties can be specified on a repository specific basis - + - Create a new instance + Basic Configurator interface for repositories - The name of the . - The instance for the specified name. - Create a new instance with the - specified name. + Interface used by basic configurator to configure a + with a default . - Called by the to create - new named instances. + A should implement this interface to support + configuration by the . + + Nicko Cadell + Gert Driesen + + + + Initialize the repository using the specified appender + + the appender to use to log all logging events + - If the is null then the root logger - must be returned. + Configure the repository to route all logging events to the + specified appender. - + - Default internal subclass of + Initialize the repository using the specified appenders + the appenders to use to log all logging events - This subclass has no additional behavior over the - class but does allow instances - to be created. + Configure the repository to route all logging events to the + specified appenders. - + - Implementation of used by + Configure repository using XML - Internal class used to provide implementation of - interface. Applications should use to get - logger instances. + Interface used by Xml configurator to configure a . - This is one of the central classes in the log4net implementation. One of the - distinctive features of log4net are hierarchical loggers and their - evaluation. The organizes the - instances into a rooted tree hierarchy. + A should implement this interface to support + configuration by the . - - The class is abstract. Only concrete subclasses of - can be created. The - is used to create instances of this type for the . + + Nicko Cadell + Gert Driesen + + + + Initialize the repository using the specified config + + the element containing the root of the config + + + The schema for the XML configuration data is defined by + the implementation. - Nicko Cadell - Gert Driesen - Aspi Havewala - Douglas de la Torre - + - This constructor created a new instance and - sets its name. + Default constructor - The name of the . - This constructor is protected and designed to be used by - a subclass that is not abstract. - - - Loggers are constructed by - objects. See for the default - logger creator. + Initializes a new instance of the class. - + - Add to the list of appenders of this - Logger instance. + Construct with properties - An appender to add to this logger + The properties to pass to this repository. - Add to the list of appenders of this - Logger instance. - - - If is already in the list of - appenders, then it won't be added again. + Initializes a new instance of the class. - + - Look for the appender named as name + Construct with a logger factory - The name of the appender to lookup - The appender with the name specified, or null. + The factory to use to create new logger instances. - Returns the named appender, or null if the appender is not found. + Initializes a new instance of the class with + the specified . - + - Remove all previously added appenders from this Logger instance. + Construct with properties and a logger factory + The properties to pass to this repository. + The factory to use to create new logger instances. - Remove all previously added appenders from this Logger instance. - - - This is useful when re-reading configuration information. + Initializes a new instance of the class with + the specified . - + - Remove the appender passed as parameter form the list of appenders. + Test if a logger exists - The appender to remove - The appender removed from the list + The name of the logger to lookup + The Logger object with the name specified - Remove the appender passed as parameter form the list of appenders. - The appender removed is not closed. - If you are discarding the appender you must call - on the appender removed. + Check if the named logger exists in the hierarchy. If so return + its reference, otherwise returns null. - + - Remove the appender passed as parameter form the list of appenders. + Returns all the currently defined loggers in the hierarchy as an Array - The name of the appender to remove - The appender removed from the list + All the defined loggers - Remove the named appender passed as parameter form the list of appenders. - The appender removed is not closed. - If you are discarding the appender you must call - on the appender removed. + Returns all the currently defined loggers in the hierarchy as an Array. + The root logger is not included in the returned + enumeration. - + - This generic form is intended to be used by wrappers. + Return a new logger instance named as the first parameter using + the default factory. - 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. - Generate a logging event for the specified using - the and . + Return a new logger instance named as the first parameter using + the default factory. - This method must not throw any exception to the caller. + If a logger of that name already exists, then it will be + returned. Otherwise, a new logger will be instantiated and + then linked with its existing ancestors as well as children. + The name of the logger to retrieve + The logger object with the name specified - + - This is the most generic printing method that is intended to be used - by wrappers. + Shutting down a hierarchy will safely close and remove + all appenders in all loggers including the root logger. - The event being logged. - Logs the specified logging event through this logger. + Shutting down a hierarchy will safely close and remove + all appenders in all loggers including the root logger. - This method must not throw any exception to the caller. + Some appenders need to be closed before the + application exists. Otherwise, pending logging events might be + lost. + + + The Shutdown method is careful to close nested + appenders before closing regular appenders. This is allows + configurations where a regular appender is attached to a logger + and again to a nested appender. - + - Checks if this logger is enabled for a given passed as parameter. + Reset all values contained in this hierarchy instance to their default. - 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 . + Reset all values contained in this hierarchy instance to their + default. This removes all appenders from all loggers, sets + the level of all non-root loggers to null, + sets their additivity flag to true and sets the level + of the root logger to . Moreover, + message disabling is set its default "off" value. - This method must not throw any exception to the caller. + Existing loggers are not removed. They are just reset. + + + This method should be used sparingly and with care as it will + block all logging until it is completed. - + - Deliver the to the attached appenders. + Log the logEvent through this hierarchy. - The event to log. + the event to log - Call the appenders in the hierarchy starting at - this. If no appenders could be found, emit a - warning. + This method should not normally be used to log. + The interface should be used + for routine logging. This interface can be obtained + using the method. - This method calls all the appenders inherited from the - hierarchy circumventing any evaluation of whether to log or not - to log the particular log request. + The logEvent is delivered to the appropriate logger and + that logger is then responsible for logging the event. - + - Closes all attached appenders implementing the interface. + Returns all the Appenders that are currently configured + An array containing all the currently configured appenders - Used to ensure that the appenders are correctly shutdown. + Returns all the instances that are currently configured. + All the loggers are searched for appenders. The appenders may also be containers + for appenders and these are also searched for additional loggers. + + + The list returned is unordered but does not contain duplicates. - + - This is the most generic printing method. This generic form is intended to be used by wrappers + Collect the appenders from an . + The appender may also be a container. - The level of the message to be logged. - The message object to log. - The exception to log, including its stack trace. - - - Generate a logging event for the specified using - the . - - + + - + - Creates a new logging event and logs the event without further checks. + Collect the appenders from an container - 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. - - - Generates a logging event and delivers it to the attached - appenders. - - + + - + - Creates a new logging event and logs the event without further checks. + Initialize the log4net system using the specified appender - The event being logged. + the appender to use to log all logging events + + + + Initialize the log4net system using the specified appenders + + the appenders to use to log all logging events + + + + Initialize the log4net system using the specified appenders + + the appenders to use to log all logging events - Delivers the logging event to the attached appenders. + This method provides the same functionality as the + method implemented + on this object, but it is protected and therefore can be called by subclasses. - - - The fully qualified type of the Logger class. - - - + - The name of this logger. + Initialize the log4net system using the specified config + the element containing the root of the config - + - The assigned level of this logger. + Initialize the log4net system using the specified config + the element containing the root of the config - The level variable need not be - assigned a value in which case it is inherited - form the hierarchy. + This method provides the same functionality as the + method implemented + on this object, but it is protected and therefore can be called by subclasses. - + - The parent of this logger. + Test if this hierarchy is disabled for the specified . + The level to check against. + + true if the repository is disabled for the level argument, false otherwise. + - The parent of this logger. - All loggers have at least one ancestor which is the root logger. + If this hierarchy has not been configured then this method will + always return true. + + + This method will return true if this repository is + disabled for level object passed as parameter and + false otherwise. + + + See also the property. - + - Loggers need to know what Hierarchy they are in. + Clear all logger definitions from the internal hashtable - Loggers need to know what Hierarchy they are in. - The hierarchy that this logger is a member of is stored - here. + This call will clear all logger definitions from the internal + hashtable. Invoking this method will irrevocably mess up the + logger hierarchy. + + + You should really know what you are doing before + invoking this method. - - - Helper implementation of the interface - - - + - Flag indicating if child loggers inherit their parents appenders + Return a new logger instance named as the first parameter using + . + The name of the logger to retrieve + The factory that will make the new logger instance + The logger object with the name specified - Additivity is set to true by default, that is children inherit - the appenders of their ancestors by default. If this variable is - set to false then the appenders found in the - ancestors of this logger are not used. However, the children - of this logger will inherit its appenders, unless the children - have their additivity flag set to false too. See - the user manual for more details. + If a logger of that name already exists, then it will be + returned. Otherwise, a new logger will be instantiated by the + parameter and linked with its existing + ancestors as well as children. - - - Lock to protect AppenderAttachedImpl variable m_appenderAttachedImpl - - - + - Gets or sets the parent logger in the hierarchy. + Sends a logger creation event to all registered listeners - - The parent logger in the hierarchy. - + The newly created logger - - Part of the Composite pattern that makes the hierarchy. - The hierarchy is parent linked rather than child linked. - + Raises the logger creation event. - + - Gets or sets a value indicating if child loggers inherit their parent's appenders. + Updates all the parents of the specified logger - - true if child loggers inherit their parent's appenders. - + The logger to update the parents for - Additivity is set to true by default, that is children inherit - the appenders of their ancestors by default. If this variable is - set to false then the appenders found in the - ancestors of this logger are not used. However, the children - of this logger will inherit its appenders, unless the children - have their additivity flag set to false too. See - the user manual for more details. + This method loops through all the potential parents of + . There 3 possible cases: + + + No entry for the potential parent of exists + + We create a ProvisionNode for this potential + parent and insert in that provision node. + + + + The entry is of type Logger for the potential parent. + + The entry is 's nearest existing parent. We + update 's parent field with this entry. We also break from + he loop because updating our parent's parent is our parent's + responsibility. + + + + The entry is of type ProvisionNode for this potential parent. + + We add to the list of children for this + potential parent. + + + - + - Gets the effective level for this logger. + Replace a with a in the hierarchy. - The nearest level in the logger hierarchy. + + - Starting from this logger, searches the logger hierarchy for a - non-null level and returns it. Otherwise, returns the level of the - root logger. + We update the links for all the children that placed themselves + in the provision node 'pn'. The second argument 'log' is a + reference for the newly created Logger, parent of all the + children in 'pn'. + + + We loop on all the children 'c' in 'pn'. + + + If the child 'c' has been already linked to a child of + 'log' then there is no need to update 'c'. + + + Otherwise, we set log's parent field to c's parent and set + c's parent field to log. - The Logger class is designed so that this method executes as - quickly as possible. - + - Gets or sets the where this - Logger instance is attached to. + Define or redefine a Level using the values in the argument - The hierarchy that this logger belongs to. + the level values - This logger must be attached to a single . + Define or redefine a Level using the values in the argument + + + Supports setting levels via the configuration file. - + - Gets or sets the assigned , if any, for this Logger. + Set a Property using the values in the argument - - The of this logger. - + the property value - The assigned can be null. + Set a Property using the values in the argument. + + + Supports setting property values via the configuration file. - + - Get the appenders contained in this logger as an - . + The fully qualified type of the Hierarchy class. - A collection of the appenders in this logger - - Get the appenders contained in this logger as an - . If no appenders - can be found, then a is returned. - + Used by the internal logger to record the Type of the + log message. - + - Gets the logger name. + Event used to notify that a logger has been created. - - The name of the logger. - - The name of this logger + Event raised when a logger is created. - + - Gets the where this - Logger instance is attached to. + Has no appender warning been emitted - - The that this logger belongs to. - - Gets the where this - Logger instance is attached to. + Flag to indicate if we have already issued a warning + about not having an appender warning. - + - Construct a new Logger + Get the root of this hierarchy - the name of the logger - Initializes a new instance of the class - with the specified name. + Get the root of this hierarchy. - + - Delegate used to handle logger creation event notifications. + Gets or sets the default instance. - The in which the has been created. - The event args that hold the instance that has been created. + The default - Delegate used to handle logger creation event notifications. + The logger factory is used to create logger instances. - + - Provides data for the event. + A class to hold the value, name and display name for a level - A event is raised every time a - is created. + A class to hold the value, name and display name for a level - + - The created + Override Object.ToString to return sensible debug info + string info about this object - + - Constructor + Value of the level - The that has been created. - Initializes a new instance of the event argument - class,with the specified . + If the value is not set (defaults to -1) the value will be looked + up for the current level with the same name. - + - Gets the that has been created. + Name of the level - The that has been created. - - - - The that has been created. - - - - - - Hierarchical organization of loggers - - - - The casual user should not have to deal with this class - directly. - - - This class is specialized in retrieving loggers by name and - also maintaining the logger hierarchy. Implements the - interface. - - - The structure of the logger hierarchy is maintained by the - method. The hierarchy is such that children - link to their parent but parents do not have any references to their - children. Moreover, loggers can be instantiated in any order, in - particular descendant before ancestor. - + The name of the level + + - In case a descendant is created before a particular ancestor, - then it creates a provision node for the ancestor and adds itself - to the provision node. Other descendants of the same ancestor add - themselves to the previously created provision node. + The name of the level. - Nicko Cadell - Gert Driesen - + - Base implementation of + Display name for the level + + The display name of the level + - Default abstract implementation of the interface. - - - Skeleton implementation of the interface. - All types can extend this type. + The display name of the level. - Nicko Cadell - Gert Driesen - + - Interface implemented by logger repositories. + Used internally to accelerate hash table searches. - This interface is implemented by logger repositories. e.g. - . + Internal class used to improve performance of + string keyed hashtables. - This interface is used by the - to obtain interfaces. + The hashcode of the string is cached for reuse. + The string is stored as an interned value. + When comparing two objects for equality + the reference equality of the interned strings is compared. Nicko Cadell Gert Driesen - + - Check if the named logger exists in the repository. If so return - its reference, otherwise returns null. + Construct key with string name - The name of the logger to lookup - The Logger object with the name specified - If the names logger exists it is returned, otherwise - null is returned. + Initializes a new instance of the class + with the specified name. + + Stores the hashcode of the string and interns + the string key to optimize comparisons. + + + The Compact Framework 1.0 the + method does not work. On the Compact Framework + the string keys are not interned nor are they + compared by reference. + + The name of the logger. - + - Returns all the currently defined loggers as an Array. + Returns a hash code for the current instance. - All the defined loggers + A hash code for the current instance. - Returns all the currently defined loggers as an Array. + Returns the cached hashcode. - + - Returns a named logger instance + Determines whether two instances + are equal. - The name of the logger to retrieve - The logger object with the name specified + The to compare with the current . + + true if the specified is equal to the current ; otherwise, false. + - Returns a named logger instance. - - - If a logger of that name already exists, then it will be - returned. Otherwise, a new logger will be instantiated and - then linked with its existing ancestors as well as children. + Compares the references of the interned strings. - - Shutdown the repository + + + Provision nodes are used where no logger instance has been specified + - Shutting down a repository will safely close and remove - all appenders in all loggers including the root logger. - - - Some appenders need to be closed before the - application exists. Otherwise, pending logging events might be - lost. + instances are used in the + when there is no specified + for that node. - The method is careful to close nested - appenders before closing regular appenders. This is allows - configurations where a regular appender is attached to a logger - and again to a nested appender. + A provision node holds a list of child loggers on behalf of + a logger that does not exist. + Nicko Cadell + Gert Driesen - + - Reset the repositories configuration to a default state + Create a new provision node with child node + A child logger to add to this node. - Reset all values contained in this instance to their - default state. - - - Existing loggers are not removed. They are just reset. - - - This method should be used sparingly and with care as it will - block all logging until it is completed. + Initializes a new instance of the class + with the specified child logger. - + - Log the through this repository. + The sits at the root of the logger hierarchy tree. - the event to log - This method should not normally be used to log. - The interface should be used - for routine logging. This interface can be obtained - using the method. + The is a regular except + that it provides several guarantees. - The logEvent is delivered to the appropriate logger and - that logger is then responsible for logging the event. + First, it cannot be assigned a null + level. Second, since the root logger cannot have a parent, the + property always returns the value of the + level field without walking the hierarchy. + Nicko Cadell + Gert Driesen - + - Returns all the Appenders that are configured as an Array. + Construct a - All the Appenders + The level to assign to the root logger. - Returns all the Appenders that are configured as an Array. + Initializes a new instance of the class with + the specified logging level. + + + The root logger names itself as "root". However, the root + logger cannot be retrieved by name. - + - The name of the repository + The fully qualified type of the RootLogger class. - - The name of the repository - - - The name of the repository. - + Used by the internal logger to record the Type of the + log message. - + - RendererMap accesses the object renderer map for this repository. + Gets the assigned level value without walking the logger hierarchy. - - RendererMap accesses the object renderer map for this repository. - + The assigned level value without walking the logger hierarchy. - RendererMap accesses the object renderer map for this repository. - - - The RendererMap holds a mapping between types and - objects. + Because the root logger cannot have a parent and its level + must not be null this property just returns the + value of . - + - The plugin map for this repository. + Gets or sets the assigned for the root logger. - The plugin map for this repository. + The of the root logger. - The plugin map holds the instances - that have been attached to this repository. + Setting the level of the root logger to a null reference + may have catastrophic results. We prevent this here. - + - Get the level map for the Repository. + Initializes the log4net environment using an XML DOM. - Get the level map for the Repository. - - - The level map defines the mappings between - level names and objects in - this repository. + Configures a using an XML DOM. + Nicko Cadell + Gert Driesen - + - The threshold for all events in this repository + Construct the configurator for a hierarchy - - The threshold for all events in this repository - + The hierarchy to build. - The threshold for all events in this repository. + Initializes a new instance of the class + with the specified . - + - Flag indicates if this repository has been configured. + Configure the hierarchy by parsing a DOM tree of XML elements. - - Flag indicates if this repository has been configured. - + The root element to parse. - Flag indicates if this repository has been configured. + Configure the hierarchy by parsing a DOM tree of XML elements. - + - Event to notify that the repository has been shutdown. + Parse appenders by IDREF. - - Event to notify that the repository has been shutdown. - + The appender ref element. + The instance of the appender that the ref refers to. - Event raised when the repository has been shutdown. + Parse an XML element that represents an appender and return + the appender. - + - Event to notify that the repository has had its configuration reset. + Parses an appender element. - - Event to notify that the repository has had its configuration reset. - + The appender element. + The appender instance or null when parsing failed. - Event raised when the repository's configuration has been - reset to default. + Parse an XML element that represents an appender and return + the appender instance. - + - Event to notify that the repository has had its configuration changed. + Parses a logger element. - - Event to notify that the repository has had its configuration changed. - + The logger element. - Event raised when the repository's configuration has been changed. + Parse an XML element that represents a logger. - + - Repository specific properties + Parses the root logger element. - - Repository specific properties - + The root element. - These properties can be specified on a repository specific basis. + Parse an XML element that represents the root logger. - + - Default Constructor + Parses the children of a logger element. + The category element. + The logger instance. + Flag to indicate if the logger is the root logger. - Initializes the repository with default (empty) properties. + Parse the child elements of a <logger> element. - + - Construct the repository using specific properties + Parses an object renderer. - the properties to set for this repository + The renderer element. - Initializes the repository with specified properties. + Parse an XML element that represents a renderer. - + - Test if logger exists + Parses a level element. - The name of the logger to lookup - The Logger object with the name specified + The level element. + The logger object to set the level on. + Flag to indicate if the logger is the root logger. - Check if the named logger exists in the repository. If so return - its reference, otherwise returns null. + Parse an XML element that represents a level. - + - Returns all the currently defined loggers in the repository + Sets a parameter on an object. - All the defined loggers + The parameter element. + The object to set the parameter on. - - Returns all the currently defined loggers in the repository as an Array. - + The parameter name must correspond to a writable property + on the object. The value of the parameter is a string, + therefore this function will attempt to set a string + property first. If unable to set a string property it + will inspect the property and its argument type. It will + attempt to call a static method called Parse on the + type of the property. This method will take a single + string argument and return a value that can be used to + set the property. - + - Return a new logger instance + Test if an element has no attributes or child elements - The name of the logger to retrieve - The logger object with the name specified + the element to inspect + true if the element has any attributes or child elements, false otherwise + + + + Test if a is constructible with Activator.CreateInstance. + + the type to inspect + true if the type is creatable using a default constructor, false otherwise + + + + Look for a method on the that matches the supplied + + the type that has the method + the name of the method + the method info found - Return a new logger instance. - - - If a logger of that name already exists, then it will be - returned. Otherwise, a new logger will be instantiated and - then linked with its existing ancestors as well as children. + The method must be a public instance method on the . + The method must be named or "Add" followed by . + The method must take a single parameter. - + - Shutdown the repository + Converts a string value to a target type. - + The type of object to convert the string to. + The string value to use as the value of the object. + - Shutdown the repository. Can be overridden in a subclass. - This base class implementation notifies the - listeners and all attached plugins of the shutdown event. + An object of type with value or + null when the conversion could not be performed. - + - + - Reset the repositories configuration to a default state + Creates an object as specified in XML. + The XML element that contains the definition of the object. + The object type to use if not explicitly specified. + The type that the returned object must be or must inherit from. + The object or null - Reset all values contained in this instance to their - default state. - - - Existing loggers are not removed. They are just reset. + Parse an XML element and create an object instance based on the configuration + data. - This method should be used sparingly and with care as it will - block all logging until it is completed. + The type of the instance may be specified in the XML. If not + specified then the is used + as the type. However the type is specified it must support the + type. - + - Log the logEvent through this repository. + key: appenderName, value: appender. + + + + + The Hierarchy being configured. + + + + + The fully qualified type of the XmlHierarchyConfigurator class. - the event to log + + Used by the internal logger to record the Type of the + log message. + + + + + + + + + + + + + + + + + + + + + Delegate used to handle logger repository shutdown event notifications + + The that is shutting down. + Empty event args - This method should not normally be used to log. - The interface should be used - for routine logging. This interface can be obtained - using the method. - - - The logEvent is delivered to the appropriate logger and - that logger is then responsible for logging the event. + Delegate used to handle logger repository shutdown event notifications. - + - Returns all the Appenders that are configured as an Array. + Delegate used to handle logger repository configuration reset event notifications - All the Appenders + The that has had its configuration reset. + Empty event args - Returns all the Appenders that are configured as an Array. + Delegate used to handle logger repository configuration reset event notifications. - + - Adds an object renderer for a specific class. + Delegate used to handle event notifications for logger repository configuration changes. - The type that will be rendered by the renderer supplied. - The object renderer used to render the object. + The that has had its configuration changed. + Empty event arguments. - Adds an object renderer for a specific class. + Delegate used to handle event notifications for logger repository configuration changes. - + - Notify the registered listeners that the repository is shutting down + Write the name of the current AppDomain to the output - Empty EventArgs - Notify any listeners that this repository is shutting down. + Write the name of the current AppDomain to the output writer + Nicko Cadell - + - Notify the registered listeners that the repository has had its configuration reset + Write the name of the current AppDomain to the output - Empty EventArgs + the writer to write to + null, state is not set - Notify any listeners that this repository's configuration has been reset. + Writes name of the current AppDomain to the output . - + - Notify the registered listeners that the repository has had its configuration changed + Write the current date to the output - Empty EventArgs - Notify any listeners that this repository's configuration has changed. + Date pattern converter, uses a to format + the current date and time to the writer as a string. + + + The value of the determines + the formatting of the date. The following values are allowed: + + + Option value + Output + + + ISO8601 + + Uses the formatter. + Formats using the "yyyy-MM-dd HH:mm:ss,fff" pattern. + + + + DATE + + Uses the formatter. + Formats using the "dd MMM yyyy HH:mm:ss,fff" for example, "06 Nov 1994 15:49:37,459". + + + + ABSOLUTE + + Uses the formatter. + Formats using the "HH:mm:ss,fff" for example, "15:49:37,459". + + + + other + + Any other pattern string uses the formatter. + This formatter passes the pattern string to the + method. + For details on valid patterns see + DateTimeFormatInfo Class. + + + + + + The date and time is in the local time zone and is rendered in that zone. + To output the time in Universal time see . + Nicko Cadell - + - Raise a configuration changed event on this repository + The used to render the date to a string - EventArgs.Empty - Applications that programmatically change the configuration of the repository should - raise this event notification to notify listeners. + The used to render the date to a string - + - The name of the repository + Initialize the converter options - - The string name of the repository - - The name of this repository. The name is - used to store and lookup the repositories - stored by the . + 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. - - - - - The threshold for all events in this repository - - - The threshold for all events in this repository - - - The threshold for all events in this repository + If any of the configuration properties are modified then + must be called again. - + - RendererMap accesses the object renderer map for this repository. + Write the current date to the output - - RendererMap accesses the object renderer map for this repository. - + that will receive the formatted result. + null, state is not set - RendererMap accesses the object renderer map for this repository. + Pass the current date and time to the + for it to render it to the writer. - The RendererMap holds a mapping between types and - objects. + The date and time passed is in the local time zone. - + - The plugin map for this repository. + The fully qualified type of the DatePatternConverter class. - - The plugin map for this repository. - - - The plugin map holds the instances - that have been attached to this repository. - + Used by the internal logger to record the Type of the + log message. - + - Get the level map for the Repository. + Write an folder path to the output - Get the level map for the Repository. - - - The level map defines the mappings between - level names and objects in - this repository. + Write an special path environment folder path to the output writer. + The value of the determines + the name of the variable to output. + should be a value in the enumeration. + Ron Grabowski - + - Flag indicates if this repository has been configured. + Write an special path environment folder path to the output - - Flag indicates if this repository has been configured. - + the writer to write to + null, state is not set - Flag indicates if this repository has been configured. + Writes the special path environment folder path to the output . + The name of the special path environment folder path to output must be set + using the + property. - + - Event to notify that the repository has been shutdown. + The fully qualified type of the EnvironmentFolderPathPatternConverter class. - - Event to notify that the repository has been shutdown. - - - Event raised when the repository has been shutdown. - + Used by the internal logger to record the Type of the + log message. - + - Event to notify that the repository has had its configuration reset. + Write an environment variable to the output - - Event to notify that the repository has had its configuration reset. - - Event raised when the repository's configuration has been - reset to default. + Write an environment variable to the output writer. + The value of the determines + the name of the variable to output. + Nicko Cadell - + - Event to notify that the repository has had its configuration changed. + Write an environment variable to the output - - Event to notify that the repository has had its configuration changed. - + the writer to write to + null, state is not set - Event raised when the repository's configuration has been changed. + Writes the environment variable to the output . + The name of the environment variable to output must be set + using the + property. - + - Repository specific properties + The fully qualified type of the EnvironmentPatternConverter class. - - Repository specific properties - - These properties can be specified on a repository specific basis + Used by the internal logger to record the Type of the + log message. - + - Basic Configurator interface for repositories + Write the current thread identity to the output - Interface used by basic configurator to configure a - with a default . - - - A should implement this interface to support - configuration by the . + Write the current thread identity to the output writer Nicko Cadell - Gert Driesen - + - Initialize the repository using the specified appender + Write the current thread identity to the output - the appender to use to log all logging events + the writer to write to + null, state is not set - Configure the repository to route all logging events to the - specified appender. + Writes the current thread identity to the output . - + - Configure repository using XML + The fully qualified type of the IdentityPatternConverter class. - - Interface used by Xml configurator to configure a . - - - A should implement this interface to support - configuration by the . - + Used by the internal logger to record the Type of the + log message. - Nicko Cadell - Gert Driesen - + - Initialize the repository using the specified config + Pattern converter for literal string instances in the pattern - the element containing the root of the config - The schema for the XML configuration data is defined by - the implementation. + Writes the literal string value specified in the + property to + the output. + Nicko Cadell - + - Default constructor + Set the next converter in the chain + The next pattern converter in the chain + The next pattern converter - Initializes a new instance of the class. + Special case the building of the pattern converter chain + for instances. Two adjacent + literals in the pattern can be represented by a single combined + pattern converter. This implementation detects when a + is added to the chain + after this converter and combines its value with this converter's + literal value. - + - Construct with properties + Write the literal to the output - The properties to pass to this repository. + the writer to write to + null, not set - Initializes a new instance of the class. + Override the formatting behavior to ignore the FormattingInfo + because we have a literal instead. + + + Writes the value of + to the output . - + - Construct with a logger factory + Convert this pattern into the rendered message - The factory to use to create new logger instances. + that will receive the formatted result. + null, not set - Initializes a new instance of the class with - the specified . + This method is not used. - + - Construct with properties and a logger factory + Writes a newline to the output - The properties to pass to this repository. - The factory to use to create new logger instances. - Initializes a new instance of the class with - the specified . + Writes the system dependent line terminator to the output. + This behavior can be overridden by setting the : + + + Option Value + Output + + + DOS + DOS or Windows line terminator "\r\n" + + + UNIX + UNIX line terminator "\n" + + + Nicko Cadell - + - Test if a logger exists + Initialize the converter - The name of the logger to lookup - The Logger object with the name specified - Check if the named logger exists in the hierarchy. If so return - its reference, otherwise returns null. + 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. - + - Returns all the currently defined loggers in the hierarchy as an Array + Write the current process ID to the output - All the defined loggers - - Returns all the currently defined loggers in the hierarchy as an Array. - The root logger is not included in the returned - enumeration. + + Write the current process ID to the output writer + Nicko Cadell - + - Return a new logger instance named as the first parameter using - the default factory. + Write the current process ID to the output + the writer to write to + null, state is not set - Return a new logger instance named as the first parameter using - the default factory. - - - If a logger of that name already exists, then it will be - returned. Otherwise, a new logger will be instantiated and - then linked with its existing ancestors as well as children. + Write the current process ID to the output . - The name of the logger to retrieve - The logger object with the name specified - + - Shutting down a hierarchy will safely close and remove - all appenders in all loggers including the root logger. + The fully qualified type of the ProcessIdPatternConverter class. - - Shutting down a hierarchy will safely close and remove - all appenders in all loggers including the root logger. - - - Some appenders need to be closed before the - application exists. Otherwise, pending logging events might be - lost. - - - The Shutdown method is careful to close nested - appenders before closing regular appenders. This is allows - configurations where a regular appender is attached to a logger - and again to a nested appender. - + Used by the internal logger to record the Type of the + log message. - + - Reset all values contained in this hierarchy instance to their default. + Property pattern converter - Reset all values contained in this hierarchy instance to their - default. This removes all appenders from all loggers, sets - the level of all non-root loggers to null, - sets their additivity flag to true and sets the level - of the root logger to . Moreover, - message disabling is set its default "off" value. - - - Existing loggers are not removed. They are just reset. + This pattern converter reads the thread and global properties. + The thread properties take priority over global properties. + See for details of the + thread properties. See for + details of the global properties. - This method should be used sparingly and with care as it will - block all logging until it is completed. + If the is specified then that will be used to + lookup a single property. If no is specified + then all properties will be dumped as a list of key value pairs. + Nicko Cadell - + - Log the logEvent through this hierarchy. + Write the property value to the output - the event to log + that will receive the formatted result. + null, state is not set - This method should not normally be used to log. - The interface should be used - for routine logging. This interface can be obtained - using the method. + Writes out the value of a named property. The property name + should be set in the + property. - The logEvent is delivered to the appropriate logger and - that logger is then responsible for logging the event. + If the is set to null + then all the properties are written as key value pairs. - + - Returns all the Appenders that are currently configured + A Pattern converter that generates a string of random characters - An array containing all the currently configured appenders - Returns all the instances that are currently configured. - All the loggers are searched for appenders. The appenders may also be containers - for appenders and these are also searched for additional loggers. + The converter generates a string of random characters. By default + the string is length 4. This can be changed by setting the + to the string value of the length required. - The list returned is unordered but does not contain duplicates. + The random characters in the string are limited to uppercase letters + and numbers only. + + + The random number generator used by this class is not cryptographically secure. + Nicko Cadell - - - Collect the appenders from an . - The appender may also be a container. - - - - - + - Collect the appenders from an container + Shared random number generator - - - + - Initialize the log4net system using the specified appender + Length of random string to generate. Default length 4. - the appender to use to log all logging events - + - Initialize the log4net system using the specified appender + Initialize the converter options - the appender to use to log all logging events - This method provides the same functionality as the - method implemented - on this object, but it is protected and therefore can be called by subclasses. + 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. - - - Initialize the log4net system using the specified config - - the element containing the root of the config - - + - Initialize the log4net system using the specified config + Write a randoim string to the output - the element containing the root of the config + the writer to write to + null, state is not set - This method provides the same functionality as the - method implemented - on this object, but it is protected and therefore can be called by subclasses. + Write a randoim string to the output . - + - Test if this hierarchy is disabled for the specified . + The fully qualified type of the RandomStringPatternConverter class. - The level to check against. - - true if the repository is disabled for the level argument, false otherwise. - - - If this hierarchy has not been configured then this method will - always return true. - - - This method will return true if this repository is - disabled for level object passed as parameter and - false otherwise. - - - See also the property. - + Used by the internal logger to record the Type of the + log message. - + - Clear all logger definitions from the internal hashtable + Write the current threads username to the output - This call will clear all logger definitions from the internal - hashtable. Invoking this method will irrevocably mess up the - logger hierarchy. - - - You should really know what you are doing before - invoking this method. + Write the current threads username to the output writer + Nicko Cadell - + - Return a new logger instance named as the first parameter using - . + Write the current threads username to the output - The name of the logger to retrieve - The factory that will make the new logger instance - The logger object with the name specified + the writer to write to + null, state is not set - If a logger of that name already exists, then it will be - returned. Otherwise, a new logger will be instantiated by the - parameter and linked with its existing - ancestors as well as children. + Write the current threads username to the output . - + - Sends a logger creation event to all registered listeners + The fully qualified type of the UserNamePatternConverter class. - The newly created logger - Raises the logger creation event. + Used by the internal logger to record the Type of the + log message. - + - Updates all the parents of the specified logger + Write the UTC date time to the output - The logger to update the parents for - This method loops through all the potential parents of - . There 3 possible cases: + Date pattern converter, uses a to format + the current date and time in Universal time. + + + See the for details on the date pattern syntax. - - - No entry for the potential parent of exists - - We create a ProvisionNode for this potential - parent and insert in that provision node. - - - - The entry is of type Logger for the potential parent. - - The entry is 's nearest existing parent. We - update 's parent field with this entry. We also break from - he loop because updating our parent's parent is our parent's - responsibility. - - - - The entry is of type ProvisionNode for this potential parent. - - We add to the list of children for this - potential parent. - - - + + Nicko Cadell - + - Replace a with a in the hierarchy. + Write the current date and time to the output - - + that will receive the formatted result. + null, state is not set - - We update the links for all the children that placed themselves - in the provision node 'pn'. The second argument 'log' is a - reference for the newly created Logger, parent of all the - children in 'pn'. - - - We loop on all the children 'c' in 'pn'. - - - If the child 'c' has been already linked to a child of - 'log' then there is no need to update 'c'. + + Pass the current date and time to the + for it to render it to the writer. - Otherwise, we set log's parent field to c's parent and set - c's parent field to log. + The date is in Universal time when it is rendered. + - + - Define or redefine a Level using the values in the argument + The fully qualified type of the UtcDatePatternConverter class. - the level values - - Define or redefine a Level using the values in the argument - - - Supports setting levels via the configuration file. - + Used by the internal logger to record the Type of the + log message. - + - Set a Property using the values in the argument + Type converter for Boolean. - the property value - Set a Property using the values in the argument. - - - Supports setting property values via the configuration file. + Supports conversion from string to bool type. + + + + Nicko Cadell + Gert Driesen - + - Event used to notify that a logger has been created. + Can the source type be converted to the type supported by this object + the type to convert + true if the conversion is possible - Event raised when a logger is created. + Returns true if the is + the type. - + - Has no appender warning been emitted + Convert the source object to the type supported by this object + the object to convert + the converted object - Flag to indicate if we have already issued a warning - about not having an appender warning. + Uses the method to convert the + argument to a . + + The object cannot be converted to the + target type. To check for this condition use the + method. + - + - Get the root of this hierarchy + Exception base type for conversion errors. - Get the root of this hierarchy. + This type extends . It + does not add any new functionality but does differentiate the + type of exception being thrown. + Nicko Cadell + Gert Driesen - + - Gets or sets the default instance. + Constructor - The default - The logger factory is used to create logger instances. + Initializes a new instance of the class. - + - A class to hold the value, name and display name for a level + Constructor + A message to include with the exception. - A class to hold the value, name and display name for a level + Initializes a new instance of the class + with the specified message. - + - Override Object.ToString to return sensible debug info + Constructor - string info about this object + 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. + + - + - Value of the level + Serialization constructor + The that holds the serialized object data about the exception being thrown. + The that contains contextual information about the source or destination. - If the value is not set (defaults to -1) the value will be looked - up for the current level with the same name. + Initializes a new instance of the class + with serialized data. - + - Name of the level + Creates a new instance of the class. - - The name of the level - + The conversion destination type. + The value to convert. + An instance of the . - The name of the level. + Creates a new instance of the class. - + - Display name for the level + Creates a new instance of the class. - - The display name of the level - + The conversion destination type. + The value to convert. + A nested exception to include. + An instance of the . - The display name of the level. + Creates a new instance of the class. - + - A class to hold the key and data for a property set in the config file + Register of type converters for specific types. - A class to hold the key and data for a property set in the config file + Maintains a registry of type converters used to convert between + types. + + + Use the and + methods to register new converters. + The and methods + lookup appropriate converters to use. + + + Nicko Cadell + Gert Driesen - + - Override Object.ToString to return sensible debug info + Private constructor - string info about this object + + Initializes a new instance of the class. + - + - Property Key + Static constructor. - - Property Key - - Property Key. + This constructor defines the intrinsic type converters. - + - Property Value + Adds a converter for a specific type. - - Property Value - + The type being converted to. + The type converter to use to convert to the destination type. - Property Value. + Adds a converter instance for a specific type. - + - Used internally to accelerate hash table searches. + Adds a converter for a specific type. + The type being converted to. + The type of the type converter to use to convert to the destination type. - Internal class used to improve performance of - string keyed hashtables. - - - The hashcode of the string is cached for reuse. - The string is stored as an interned value. - When comparing two objects for equality - the reference equality of the interned strings is compared. + Adds a converter for a specific type. - Nicko Cadell - Gert Driesen - + - Construct key with string name + Gets the type converter to use to convert values to the destination type. + The type being converted from. + The type being converted to. + + The type converter instance to use for type conversions or null + if no type converter is found. + - Initializes a new instance of the class - with the specified name. - - - Stores the hashcode of the string and interns - the string key to optimize comparisons. + Gets the type converter to use to convert values to the destination type. - - The Compact Framework 1.0 the - method does not work. On the Compact Framework - the string keys are not interned nor are they - compared by reference. - - The name of the logger. - + - Returns a hash code for the current instance. + Gets the type converter to use to convert values to the destination type. - A hash code for the current instance. + The type being converted to. + + The type converter instance to use for type conversions or null + if no type converter is found. + - Returns the cached hashcode. + Gets the type converter to use to convert values to the destination type. - + - Determines whether two instances - are equal. + Lookups the type converter to use as specified by the attributes on the + destination type. - The to compare with the current . + The type being converted to. - true if the specified is equal to the current ; otherwise, false. + The type converter instance to use for type conversions or null + if no type converter is found. + + + + + Creates the instance of the type converter. + + The type of the type converter. + + The type converter instance to use for type conversions or null + if no type converter is found. - Compares the references of the interned strings. + The type specified for the type converter must implement + the or interfaces + and must have a public default (no argument) constructor. - + + + The fully qualified type of the ConverterRegistry class. + + + Used by the internal logger to record the Type of the + log message. + + + + + Mapping from to type converter. + + + - Provision nodes are used where no logger instance has been specified + Supports conversion from string to type. - instances are used in the - when there is no specified - for that node. - - - A provision node holds a list of child loggers on behalf of - a logger that does not exist. + Supports conversion from string to type. + + + Nicko Cadell Gert Driesen - + - Create a new provision node with child node + Can the source type be converted to the type supported by this object - A child logger to add to this node. + the type to convert + true if the conversion is possible - Initializes a new instance of the class - with the specified child logger. + Returns true if the is + the type. - + - The sits at the root of the logger hierarchy tree. + Overrides the ConvertFrom method of IConvertFrom. + the object to convert to an encoding + the encoding - The is a regular except - that it provides several guarantees. - - - First, it cannot be assigned a null - level. Second, since the root logger cannot have a parent, the - property always returns the value of the - level field without walking the hierarchy. + Uses the method to + convert the argument to an . - Nicko Cadell - Gert Driesen + + The object cannot be converted to the + target type. To check for this condition use the + method. + - + - Construct a + Interface supported by type converters - The level to assign to the root logger. - Initializes a new instance of the class with - the specified logging level. - - - The root logger names itself as "root". However, the root - logger cannot be retrieved by name. + This interface supports conversion from a single type to arbitrary types. + See . + Nicko Cadell - + - Gets the assigned level value without walking the logger hierarchy. + Returns whether this converter can convert the object to the specified type - The assigned level value without walking the logger hierarchy. + A Type that represents the type you want to convert to + true if the conversion is possible - Because the root logger cannot have a parent and its level - must not be null this property just returns the - value of . + Test if the type supported by this converter can be converted to the + . - + - Gets or sets the assigned for the root logger. + Converts the given value object to the specified type, using the arguments - - The of the root logger. - + the object to convert + The Type to convert the value parameter to + the converted object - Setting the level of the root logger to a null reference - may have catastrophic results. We prevent this here. + Converts the (which must be of the type supported + by this converter) to the specified.. - + - Initializes the log4net environment using an XML DOM. + Supports conversion from string to type. - Configures a using an XML DOM. + Supports conversion from string to type. + + Nicko Cadell - Gert Driesen - + - Construct the configurator for a hierarchy + Can the source type be converted to the type supported by this object - The hierarchy to build. + the type to convert + true if the conversion is possible - Initializes a new instance of the class - with the specified . + Returns true if the is + the type. - + - Configure the hierarchy by parsing a DOM tree of XML elements. + Overrides the ConvertFrom method of IConvertFrom. - The root element to parse. + the object to convert to an IPAddress + the IPAddress - Configure the hierarchy by parsing a DOM tree of XML elements. + Uses the method to convert the + argument to an . + If that fails then the string is resolved as a DNS hostname. + + The object cannot be converted to the + target type. To check for this condition use the + method. + - + - Parse appenders by IDREF. + Valid characters in an IPv4 or IPv6 address string. (Does not support subnets) - The appender ref element. - The instance of the appender that the ref refers to. - - - Parse an XML element that represents an appender and return - the appender. - - - + - Parses an appender element. + Supports conversion from string to type. - The appender element. - The appender instance or null when parsing failed. - Parse an XML element that represents an appender and return - the appender instance. + Supports conversion from string to type. + + + The string is used as the + of the . + + + + Nicko Cadell - + - Parses a logger element. + Can the source type be converted to the type supported by this object - The logger element. + the type to convert + true if the conversion is possible - Parse an XML element that represents a logger. + Returns true if the is + the type. - + - Parses the root logger element. + Overrides the ConvertFrom method of IConvertFrom. - The root element. + the object to convert to a PatternLayout + the PatternLayout - Parse an XML element that represents the root logger. + Creates and returns a new using + the as the + . + + The object cannot be converted to the + target type. To check for this condition use the + method. + - + - Parses the children of a logger element. + Convert between string and - The category element. - The logger instance. - Flag to indicate if the logger is the root logger. - Parse the child elements of a <logger> element. + Supports conversion from string to type, + and from a type to a string. + + + The string is used as the + of the . + + + + Nicko Cadell - + - Parses an object renderer. + Can the target type be converted to the type supported by this object - The renderer element. + A that represents the type you want to convert to + true if the conversion is possible - Parse an XML element that represents a renderer. + Returns true if the is + assignable from a type. - + - Parses a level element. + Converts the given value object to the specified type, using the arguments - The level element. - The logger object to set the level on. - Flag to indicate if the logger is the root logger. + the object to convert + The Type to convert the value parameter to + the converted object - Parse an XML element that represents a level. + Uses the method to convert the + argument to a . + + The object cannot be converted to the + . To check for this condition use the + method. + - + - Sets a parameter on an object. + Can the source type be converted to the type supported by this object - The parameter element. - The object to set the parameter on. + the type to convert + true if the conversion is possible - The parameter name must correspond to a writable property - on the object. The value of the parameter is a string, - therefore this function will attempt to set a string - property first. If unable to set a string property it - will inspect the property and its argument type. It will - attempt to call a static method called Parse on the - type of the property. This method will take a single - string argument and return a value that can be used to - set the property. + + Returns true if the is + the type. + - + - Test if an element has no attributes or child elements + Overrides the ConvertFrom method of IConvertFrom. - the element to inspect - true if the element has any attributes or child elements, false otherwise + the object to convert to a PatternString + the PatternString + + + Creates and returns a new using + the as the + . + + + + The object cannot be converted to the + target type. To check for this condition use the + method. + - + - Test if a is constructible with Activator.CreateInstance. + Supports conversion from string to type. - the type to inspect - true if the type is creatable using a default constructor, false otherwise + + + Supports conversion from string to type. + + + + + + Nicko Cadell - + - Look for a method on the that matches the supplied + Can the source type be converted to the type supported by this object - the type that has the method - the name of the method - the method info found + the type to convert + true if the conversion is possible - The method must be a public instance method on the . - The method must be named or "Add" followed by . - The method must take a single parameter. + Returns true if the is + the type. - + - Converts a string value to a target type. + Overrides the ConvertFrom method of IConvertFrom. - The type of object to convert the string to. - The string value to use as the value of the object. - + the object to convert to a Type + the Type + - An object of type with value or - null when the conversion could not be performed. + Uses the method to convert the + argument to a . + Additional effort is made to locate partially specified types + by searching the loaded assemblies. - + + + The object cannot be converted to the + target type. To check for this condition use the + method. + - + - Creates an object as specified in XML. + Attribute used to associate a type converter - The XML element that contains the definition of the object. - The object type to use if not explicitly specified. - The type that the returned object must be or must inherit from. - The object or null - Parse an XML element and create an object instance based on the configuration - data. + Class and Interface level attribute that specifies a type converter + to use with the associated type. - The type of the instance may be specified in the XML. If not - specified then the is used - as the type. However the type is specified it must support the - type. + To associate a type converter with a target type apply a + TypeConverterAttribute to the target type. Specify the + type of the type converter on the attribute. + Nicko Cadell + Gert Driesen - - - key: appenderName, value: appender. - - - + - The Hierarchy being configured. + The string type name of the type converter - + - Delegate used to handle logger repository shutdown event notifications + Default constructor - The that is shutting down. - Empty event args - Delegate used to handle logger repository shutdown event notifications. + Default constructor - + - Delegate used to handle logger repository configuration reset event notifications + Create a new type converter attribute for the specified type name - The that has had its configuration reset. - Empty event args + The string type name of the type converter - Delegate used to handle logger repository configuration reset event notifications. + The type specified must implement the + or the interfaces. - + - Delegate used to handle event notifications for logger repository configuration changes. + Create a new type converter attribute for the specified type - The that has had its configuration changed. - Empty event arguments. + The type of the type converter - Delegate used to handle event notifications for logger repository configuration changes. + The type specified must implement the + or the interfaces. - + - Write the name of the current AppDomain to the output + The string type name of the type converter + + The string type name of the type converter + - Write the name of the current AppDomain to the output writer + The type specified must implement the + or the interfaces. - Nicko Cadell - + - Write the name of the current AppDomain to the output + A straightforward implementation of the interface. - the writer to write to - null, state is not set - Writes name of the current AppDomain to the output . + This is the default implementation of the + interface. Implementors of the interface + should aggregate an instance of this type. + Nicko Cadell + Gert Driesen - + - Write the current date to the output + Constructor - Date pattern converter, uses a to format - the current date and time to the writer as a string. - - - The value of the determines - the formatting of the date. The following values are allowed: - - - Option value - Output - - - ISO8601 - - Uses the formatter. - Formats using the "yyyy-MM-dd HH:mm:ss,fff" pattern. - - - - DATE - - Uses the formatter. - Formats using the "dd MMM yyyy HH:mm:ss,fff" for example, "06 Nov 1994 15:49:37,459". - - - - ABSOLUTE - - Uses the formatter. - Formats using the "HH:mm:ss,fff" for example, "15:49:37,459". - - - - other - - Any other pattern string uses the formatter. - This formatter passes the pattern string to the - method. - For details on valid patterns see - DateTimeFormatInfo Class. - - - - - - The date and time is in the local time zone and is rendered in that zone. - To output the time in Universal time see . + Initializes a new instance of the class. - Nicko Cadell - + - The used to render the date to a string + Append on on all attached appenders. + The event being logged. + The number of appenders called. - The used to render the date to a string + Calls the method on all + attached appenders. - + - Initialize the converter options + Append on on all attached appenders. + The array of events being logged. + The number of appenders called. - 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. + Calls the method on all + attached appenders. - + - Write the current date to the output + Calls the DoAppende method on the with + the objects supplied. - that will receive the formatted result. - null, state is not set + The appender + The events - Pass the current date and time to the - for it to render it to the writer. - - - The date and time passed is in the local time zone. + If the supports the + interface then the will be passed + through using that interface. Otherwise the + objects in the array will be passed one at a time. - + - Write an environment variable to the output + Attaches an appender. + The appender to add. - Write an environment variable to the output writer. - The value of the determines - the name of the variable to output. + If the appender is already in the list it won't be added again. - Nicko Cadell - + - Write an environment variable to the output + Gets an attached appender with the specified name. - the writer to write to - null, state is not set + The name of the appender to get. + + The appender with the name specified, or null if no appender with the + specified name is found. + - Writes the environment variable to the output . - The name of the environment variable to output must be set - using the - property. + Lookup an attached appender by name. - + - Write the current thread identity to the output + Removes all attached appenders. - Write the current thread identity to the output writer + Removes and closes all attached appenders - Nicko Cadell - + - Write the current thread identity to the output + Removes the specified appender from the list of attached appenders. - the writer to write to - null, state is not set + The appender to remove. + The appender removed from the list - Writes the current thread identity to the output . + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. - + - Pattern converter for literal string instances in the pattern + 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 - Writes the literal string value specified in the - property to - the output. + The appender removed is not closed. + If you are discarding the appender you must call + on the appender removed. - Nicko Cadell - + - Set the next converter in the chain + List of appenders - The next pattern converter in the chain - The next pattern converter - - - Special case the building of the pattern converter chain - for instances. Two adjacent - literals in the pattern can be represented by a single combined - pattern converter. This implementation detects when a - is added to the chain - after this converter and combines its value with this converter's - literal value. - - - + - Write the literal to the output + Array of appenders, used to cache the m_appenderList + + + + + The fully qualified type of the AppenderAttachedImpl class. - the writer to write to - null, not set - - Override the formatting behavior to ignore the FormattingInfo - because we have a literal instead. - - - Writes the value of - to the output . - + Used by the internal logger to record the Type of the + log message. - + - Convert this pattern into the rendered message + Gets all attached appenders. - that will receive the formatted result. - null, not set + + A collection of attached appenders, or null if there + are no attached appenders. + - This method is not used. + The read only collection of all currently attached appenders. - + - Writes a newline to the output + This class aggregates several PropertiesDictionary collections together. - Writes the system dependent line terminator to the output. - This behavior can be overridden by setting the : + Provides a dictionary style lookup over an ordered list of + collections. - - - Option Value - Output - - - DOS - DOS or Windows line terminator "\r\n" - - - UNIX - UNIX line terminator "\n" - - Nicko Cadell - + - Initialize the converter + Constructor - 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. + Initializes a new instance of the class. - + - Write the current process ID to the output + Add a Properties Dictionary to this composite collection + the properties to add - Write the current process ID to the output writer + Properties dictionaries added first take precedence over dictionaries added + later. - Nicko Cadell - + - Write the current process ID to the output + Flatten this composite collection into a single properties dictionary - the writer to write to - null, state is not set + the flattened dictionary - Write the current process ID to the output . + Reduces the collection of ordered dictionaries to a single dictionary + containing the resultant values for the keys. - + - Property pattern converter + Gets the value of a property + + The value for the property with the specified key + - This pattern converter reads the thread and global properties. - The thread properties take priority over global properties. - See for details of the - thread properties. See for - details of the global properties. + Looks up the value for the specified. + The collections are searched + in the order in which they were added to this collection. The value + returned is the value held by the first collection that contains + the specified key. - If the is specified then that will be used to - lookup a single property. If no is specified - then all properties will be dumped as a list of key value pairs. + If none of the collections contain the specified key then + null is returned. - Nicko Cadell - + - Write the property value to the output + Base class for Context Properties implementations - that will receive the formatted result. - null, state is not set - Writes out the value of a named property. The property name - should be set in the - property. - - - If the is set to null - then all the properties are written as key value pairs. + This class defines a basic property get set accessor + Nicko Cadell - + - A Pattern converter that generates a string of random characters + Gets or sets the value of a property + + The value for the property with the specified key + - The converter generates a string of random characters. By default - the string is length 4. This can be changed by setting the - to the string value of the length required. - - - The random characters in the string are limited to uppercase letters - and numbers only. + Gets or sets the value of a property + + + + + Wrapper class used to map converter names to converter types + + - The random number generator used by this class is not cryptographically secure. + Pattern converter info class used during configuration by custom + PatternString and PatternLayer converters. - Nicko Cadell - + - Shared random number generator + default constructor - + - Length of random string to generate. Default length 4. + + - + - Initialize the converter options + Gets or sets the name of the conversion pattern - 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 name of the pattern in the format string - + - Write a randoim string to the output + Gets or sets the type of the converter - the writer to write to - null, state is not set - Write a randoim string to the output . + The value specified must extend the + type. - + - Write the current threads username to the output + - - - Write the current threads username to the output writer - - - Nicko Cadell - + - Write the current threads username to the output + Subclass of that maintains a count of + the number of bytes written. - the writer to write to - null, state is not set - Write the current threads username to the output . + This writer counts the number of bytes written. + Nicko Cadell + Gert Driesen - + - Write the UTC date time to the output + that does not leak exceptions - Date pattern converter, uses a to format - the current date and time in Universal time. - - - See the for details on the date pattern syntax. + does not throw exceptions when things go wrong. + Instead, it delegates error handling to its . - Nicko Cadell + Gert Driesen - + - Write the current date and time to the output + Adapter that extends and forwards all + messages to an instance of . - that will receive the formatted result. - null, state is not set - Pass the current date and time to the - for it to render it to the writer. - - - The date is in Universal time when it is rendered. + Adapter that extends and forwards all + messages to an instance of . - + Nicko Cadell - + - Type converter for Boolean. + The writer to forward messages to + + + + + Create an instance of that forwards all + messages to a . + The to forward to - Supports conversion from string to bool type. + Create an instance of that forwards all + messages to a . - - - - Nicko Cadell - Gert Driesen - + - Can the source type be converted to the type supported by this object + Closes the writer and releases any system resources associated with the writer - the type to convert - true if the conversion is possible - Returns true if the is - the type. - + - Convert the source object to the type supported by this object + Dispose this writer - the object to convert - the converted object + flag indicating if we are being disposed - Uses the method to convert the - argument to a . + Dispose this writer - - The object cannot be converted to the - target type. To check for this condition use the - method. - - + - Exception base type for conversion errors. + Flushes any buffered output - This type extends . It - does not add any new functionality but does differentiate the - type of exception being thrown. + Clears all buffers for the writer and causes any buffered data to be written + to the underlying device - Nicko Cadell - Gert Driesen - + - Constructor + Writes a character to the wrapped TextWriter + the value to write to the TextWriter - Initializes a new instance of the class. + Writes a character to the wrapped TextWriter - + - Constructor + Writes a character buffer to the wrapped TextWriter - A message to include with the exception. + the data buffer + the start index + the number of characters to write - Initializes a new instance of the class - with the specified message. + Writes a character buffer to the wrapped TextWriter - + - Constructor + Writes a string to the wrapped TextWriter - A message to include with the exception. - A nested exception to include. + the value to write to the TextWriter - Initializes a new instance of the class - with the specified message and inner exception. + Writes a string to the wrapped TextWriter - + - Serialization constructor + Gets or sets the underlying . - The that holds the serialized object data about the exception being thrown. - The that contains contextual information about the source or destination. + + The underlying . + - Initializes a new instance of the class - with serialized data. + Gets or sets the underlying . - + - Creates a new instance of the class. + The Encoding in which the output is written - The conversion destination type. - The value to convert. - An instance of the . + + The + - Creates a new instance of the class. + The Encoding in which the output is written - + - Creates a new instance of the class. + Gets an object that controls formatting - The conversion destination type. - The value to convert. - A nested exception to include. - An instance of the . + + The format provider + - Creates a new instance of the class. + Gets an object that controls formatting - + - Register of type converters for specific types. + Gets or sets the line terminator string used by the TextWriter + + The line terminator to use + - Maintains a registry of type converters used to convert between - types. - - - Use the and - methods to register new converters. - The and methods - lookup appropriate converters to use. + Gets or sets the line terminator string used by the TextWriter - - - Nicko Cadell - Gert Driesen - + - Private constructor + Constructor + the writer to actually write to + the error handler to report error to - Initializes a new instance of the class. + + Create a new QuietTextWriter using a writer and error handler + - + - Static constructor. + Writes a character to the underlying writer + the char to write - This constructor defines the intrinsic type converters. + Writes a character to the underlying writer - + - Adds a converter for a specific type. + Writes a buffer to the underlying writer - The type being converted to. - The type converter to use to convert to the destination type. + the buffer to write + the start index to write from + the number of characters to write - Adds a converter instance for a specific type. + Writes a buffer to the underlying writer - + - Adds a converter for a specific type. + Writes a string to the output. - The type being converted to. - The type of the type converter to use to convert to the destination type. + The string data to write to the output. - Adds a converter for a specific type. + Writes a string to the output. - + - Gets the type converter to use to convert values to the destination type. + Closes the underlying output writer. - The type being converted from. - The type being converted to. - - The type converter instance to use for type conversions or null - if no type converter is found. - - Gets the type converter to use to convert values to the destination type. + Closes the underlying output writer. - + - Gets the type converter to use to convert values to the destination type. + The error handler instance to pass all errors to - The type being converted to. - - The type converter instance to use for type conversions or null - if no type converter is found. - + + + + Flag to indicate if this writer is closed + + + + + Gets or sets the error handler that all errors are passed to. + + + The error handler that all errors are passed to. + - Gets the type converter to use to convert values to the destination type. + Gets or sets the error handler that all errors are passed to. - + - Lookups the type converter to use as specified by the attributes on the - destination type. + Gets a value indicating whether this writer is closed. - The type being converted to. - - The type converter instance to use for type conversions or null - if no type converter is found. - + + true if this writer is closed, otherwise false. + + + + Gets a value indicating whether this writer is closed. + + - + - Creates the instance of the type converter. + Constructor - The type of the type converter. - - The type converter instance to use for type conversions or null - if no type converter is found. - + The to actually write to. + The to report errors to. - The type specified for the type converter must implement - the or interfaces - and must have a public default (no argument) constructor. + Creates a new instance of the class + with the specified and . - + - Mapping from to type converter. + Writes a character to the underlying writer and counts the number of bytes written. + the char to write + + + Overrides implementation of . Counts + the number of bytes written. + + - + - Supports conversion from string to type. + Writes a buffer to the underlying writer and counts the number of bytes written. + the buffer to write + the start index to write from + the number of characters to write - Supports conversion from string to type. + Overrides implementation of . Counts + the number of bytes written. - - - - Nicko Cadell - Gert Driesen - + - Can the source type be converted to the type supported by this object + Writes a string to the output and counts the number of bytes written. - the type to convert - true if the conversion is possible + The string data to write to the output. - Returns true if the is - the type. + Overrides implementation of . Counts + the number of bytes written. - + - Overrides the ConvertFrom method of IConvertFrom. + Total number of bytes written. - the object to convert to an encoding - the encoding + + + + Gets or sets the total number of bytes written. + + + The total number of bytes written. + - Uses the method to - convert the argument to an . + Gets or sets the total number of bytes written. - - The object cannot be converted to the - target type. To check for this condition use the - method. - - + - Interface supported by type converters + A fixed size rolling buffer of logging events. - This interface supports conversion from a single type to arbitrary types. - See . + An array backed fixed size leaky bucket. Nicko Cadell + Gert Driesen - + - Returns whether this converter can convert the object to the specified type + Constructor - A Type that represents the type you want to convert to - true if the conversion is possible + The maximum number of logging events in the buffer. - Test if the type supported by this converter can be converted to the - . + Initializes a new instance of the class with + the specified maximum number of buffered logging events. + The argument is not a positive integer. - + - Converts the given value object to the specified type, using the arguments + Appends a to the buffer. - the object to convert - The Type to convert the value parameter to - the converted object + The event to append to the buffer. + The event discarded from the buffer, if the buffer is full, otherwise null. - Converts the (which must be of the type supported - by this converter) to the specified.. + Append an event to the buffer. If the buffer still contains free space then + null is returned. If the buffer is full then an event will be dropped + to make space for the new event, the event dropped is returned. - + - Supports conversion from string to type. + Get and remove the oldest event in the buffer. + The oldest logging event in the buffer - Supports conversion from string to type. + Gets the oldest (first) logging event in the buffer and removes it + from the buffer. - - - Nicko Cadell - + - Can the source type be converted to the type supported by this object + Pops all the logging events from the buffer into an array. - the type to convert - true if the conversion is possible + An array of all the logging events in the buffer. - Returns true if the is - the type. + Get all the events in the buffer and clear the buffer. - + - Overrides the ConvertFrom method of IConvertFrom. + Clear the buffer - the object to convert to an IPAddress - the IPAddress - Uses the method to convert the - argument to an . - If that fails then the string is resolved as a DNS hostname. + Clear the buffer of all events. The events in the buffer are lost. - - The object cannot be converted to the - target type. To check for this condition use the - method. - - - - - Valid characters in an IPv4 or IPv6 address string. (Does not support subnets) - - + - Supports conversion from string to type. + Gets the th oldest event currently in the buffer. + The th oldest event currently in the buffer. - Supports conversion from string to type. - - - The string is used as the - of the . + If is outside the range 0 to the number of events + currently in the buffer, then null is returned. - - - - Nicko Cadell - + - Can the source type be converted to the type supported by this object + Gets the maximum size of the buffer. - the type to convert - true if the conversion is possible + The maximum size of the buffer. - Returns true if the is - the type. + Gets the maximum size of the buffer - + - Overrides the ConvertFrom method of IConvertFrom. + Gets the number of logging events in the buffer. - the object to convert to a PatternLayout - the PatternLayout + The number of logging events in the buffer. - Creates and returns a new using - the as the - . + This number is guaranteed to be in the range 0 to + (inclusive). - - The object cannot be converted to the - target type. To check for this condition use the - method. - - + - Convert between string and + An always empty . - Supports conversion from string to type, - and from a type to a string. - - - The string is used as the - of the . + A singleton implementation of the + interface that always represents an empty collection. - - - Nicko Cadell + Gert Driesen - + - Can the target type be converted to the type supported by this object + Initializes a new instance of the class. - A that represents the type you want to convert to - true if the conversion is possible - Returns true if the is - assignable from a type. + Uses a private access modifier to enforce the singleton pattern. - + - Converts the given value object to the specified type, using the arguments + Copies the elements of the to an + , starting at a particular Array index. - the object to convert - The Type to convert the value parameter to - the converted object + The one-dimensional + that is the destination of the elements copied from + . The Array must have zero-based + indexing. + The zero-based index in array at which + copying begins. - Uses the method to convert the - argument to a . + As the collection is empty no values are copied into the array. - - The object cannot be converted to the - . To check for this condition use the - method. - - + - Can the source type be converted to the type supported by this object + Returns an enumerator that can iterate through a collection. - the type to convert - true if the conversion is possible + + An that can be used to + iterate through the collection. + - Returns true if the is - the type. + As the collection is empty a is returned. - + - Overrides the ConvertFrom method of IConvertFrom. + The singleton instance of the empty collection. - the object to convert to a PatternString - the PatternString + + + + Gets the singleton instance of the empty collection. + + The singleton instance of the empty collection. - Creates and returns a new using - the as the - . + Gets the singleton instance of the empty collection. - - The object cannot be converted to the - target type. To check for this condition use the - method. - - + - Supports conversion from string to type. + Gets a value indicating if access to the is synchronized (thread-safe). + + true if access to the is synchronized (thread-safe); otherwise, false. + - Supports conversion from string to type. + For the this property is always true. - - - - Nicko Cadell - + - Can the source type be converted to the type supported by this object + Gets the number of elements contained in the . - the type to convert - true if the conversion is possible + + The number of elements contained in the . + - Returns true if the is - the type. + As the collection is empty the is always 0. - + - Overrides the ConvertFrom method of IConvertFrom. + Gets an object that can be used to synchronize access to the . - the object to convert to a Type - the Type + + An object that can be used to synchronize access to the . + - Uses the method to convert the - argument to a . - Additional effort is made to locate partially specified types - by searching the loaded assemblies. + As the collection is empty and thread safe and synchronized this instance is also + the object. - - The object cannot be converted to the - target type. To check for this condition use the - method. - - + - Attribute used to associate a type converter + An always empty . - Class and Interface level attribute that specifies a type converter - to use with the associated type. - - - To associate a type converter with a target type apply a - TypeConverterAttribute to the target type. Specify the - type of the type converter on the attribute. + A singleton implementation of the + interface that always represents an empty collection. Nicko Cadell Gert Driesen - - - The string type name of the type converter - - - + - Default constructor + Initializes a new instance of the class. - Default constructor + Uses a private access modifier to enforce the singleton pattern. - + - Create a new type converter attribute for the specified type name + Copies the elements of the to an + , starting at a particular Array index. - The string type name of the type converter + The one-dimensional + that is the destination of the elements copied from + . The Array must have zero-based + indexing. + The zero-based index in array at which + copying begins. - The type specified must implement the - or the interfaces. + As the collection is empty no values are copied into the array. - + - Create a new type converter attribute for the specified type + Returns an enumerator that can iterate through a collection. - The type of the type converter + + An that can be used to + iterate through the collection. + - The type specified must implement the - or the interfaces. + As the collection is empty a is returned. - + - The string type name of the type converter + Adds an element with the provided key and value to the + . - - The string type name of the type converter - + The to use as the key of the element to add. + The to use as the value of the element to add. - The type specified must implement the - or the interfaces. + As the collection is empty no new values can be added. A + is thrown if this method is called. + This dictionary is always empty and cannot be modified. - + - A straightforward implementation of the interface. + Removes all elements from the . - This is the default implementation of the - interface. Implementors of the interface - should aggregate an instance of this type. + As the collection is empty no values can be removed. A + is thrown if this method is called. - Nicko Cadell - Gert Driesen + This dictionary is always empty and cannot be modified. - + - Constructor + Determines whether the contains an element + with the specified key. + The key to locate in the . + false - Initializes a new instance of the class. + As the collection is empty the method always returns false. - + - Append on on all attached appenders. + Returns an enumerator that can iterate through a collection. - The event being logged. - The number of appenders called. + + An that can be used to + iterate through the collection. + - Calls the method on all - attached appenders. + As the collection is empty a is returned. - + - Append on on all attached appenders. + Removes the element with the specified key from the . - The array of events being logged. - The number of appenders called. + The key of the element to remove. - Calls the method on all - attached appenders. + As the collection is empty no values can be removed. A + is thrown if this method is called. + This dictionary is always empty and cannot be modified. - + - Calls the DoAppende method on the with - the objects supplied. + The singleton instance of the empty dictionary. - The appender - The events + + + + Gets the singleton instance of the . + + The singleton instance of the . - If the supports the - interface then the will be passed - through using that interface. Otherwise the - objects in the array will be passed one at a time. + Gets the singleton instance of the . - + - Attaches an appender. + Gets a value indicating if access to the is synchronized (thread-safe). - The appender to add. + + true if access to the is synchronized (thread-safe); otherwise, false. + - If the appender is already in the list it won't be added again. + For the this property is always true. - + - Gets an attached appender with the specified name. + Gets the number of elements contained in the - The name of the appender to get. - - The appender with the name specified, or null if no appender with the - specified name is found. - + + The number of elements contained in the . + - Lookup an attached appender by name. + As the collection is empty the is always 0. - + - Removes all attached appenders. + Gets an object that can be used to synchronize access to the . + + An object that can be used to synchronize access to the . + - Removes and closes all attached appenders + As the collection is empty and thread safe and synchronized this instance is also + the object. - + - Removes the specified appender from the list of attached appenders. + Gets a value indicating whether the has a fixed size. - The appender to remove. - The appender removed from the list + true - The appender removed is not closed. - If you are discarding the appender you must call - on the appender removed. + As the collection is empty always returns true. - + - Removes the appender with the specified name from the list of appenders. + Gets a value indicating whether the is read-only. - The name of the appender to remove. - The appender removed from the list + true - The appender removed is not closed. - If you are discarding the appender you must call - on the appender removed. + As the collection is empty always returns true. - + - List of appenders + Gets an containing the keys of the . + An containing the keys of the . + + + As the collection is empty a is returned. + + - + - Array of appenders, used to cache the m_appenderList + Gets an containing the values of the . + An containing the values of the . + + + As the collection is empty a is returned. + + - + - Gets all attached appenders. + Gets or sets the element with the specified key. - - A collection of attached appenders, or null if there - are no attached appenders. - + The key of the element to get or set. + null - The read only collection of all currently attached appenders. + As the collection is empty no values can be looked up or stored. + If the index getter is called then null is returned. + A is thrown if the setter is called. + This dictionary is always empty and cannot be modified. - + - This class aggregates several PropertiesDictionary collections together. + Contain the information obtained when parsing formatting modifiers + in conversion modifiers. - Provides a dictionary style lookup over an ordered list of - collections. + Holds the formatting information extracted from the format string by + the . This is used by the + objects when rendering the output. Nicko Cadell + Gert Driesen - + - Constructor + Defaut Constructor - Initializes a new instance of the class. + Initializes a new instance of the class. - + - Add a Properties Dictionary to this composite collection + Constructor - the properties to add - Properties dictionaries added first take precedence over dictionaries added - later. + Initializes a new instance of the class + with the specified parameters. - + - Flatten this composite collection into a single properties dictionary + Gets or sets the minimum value. - the flattened dictionary + + The minimum value. + - Reduces the collection of ordered dictionaries to a single dictionary - containing the resultant values for the keys. + Gets or sets the minimum value. - + - Gets the value of a property + Gets or sets the maximum value. - The value for the property with the specified key + The maximum value. - Looks up the value for the specified. - The collections are searched - in the order in which they were added to this collection. The value - returned is the value held by the first collection that contains - the specified key. - - - If none of the collections contain the specified key then - null is returned. + Gets or sets the maximum value. - + - Base class for Context Properties implementations + Gets or sets a flag indicating whether left align is enabled + or not. + + A flag indicating whether left align is enabled or not. + - This class defines a basic property get set accessor + Gets or sets a flag indicating whether left align is enabled or not. - Nicko Cadell - + - Gets or sets the value of a property + Implementation of Properties collection for the - - The value for the property with the specified key - - Gets or sets the value of a property + This class implements a properties collection that is thread safe and supports both + storing properties and capturing a read only copy of the current propertied. + + + This class is optimized to the scenario where the properties are read frequently + and are modified infrequently. + Nicko Cadell - + - Subclass of that maintains a count of - the number of bytes written. + The read only copy of the properties. - This writer counts the number of bytes written. + This variable is declared volatile to prevent the compiler and JIT from + reordering reads and writes of this thread performed on different threads. - Nicko Cadell - Gert Driesen - + - that does not leak exceptions + Lock object used to synchronize updates within this instance + + + + + Constructor - does not throw exceptions when things go wrong. - Instead, it delegates error handling to its . + Initializes a new instance of the class. - Nicko Cadell - Gert Driesen - + - Adapter that extends and forwards all - messages to an instance of . + Remove a property from the global context + the key for the entry to remove - Adapter that extends and forwards all - messages to an instance of . + Removing an entry from the global context properties is relatively expensive compared + with reading a value. - Nicko Cadell - + - The writer to forward messages to + Clear the global context properties - + - Create an instance of that forwards all - messages to a . + Get a readonly immutable copy of the properties - The to forward to + the current global context properties - Create an instance of that forwards all - messages to a . + This implementation is fast because the GlobalContextProperties class + stores a readonly copy of the properties. - + - Closes the writer and releases any system resources associated with the writer + Gets or sets the value of a property + + The value for the property with the specified key + + Reading the value for a key is faster than setting the value. + When the value is written a new read only copy of + the properties is created. - + - Dispose this writer + The static class ILogExtensions contains a set of widely used + methods that ease the interaction with the ILog interface implementations. - flag indicating if we are being disposed - Dispose this writer + This class contains methods for logging at different levels and checks the + properties for determining if those logging levels are enabled in the current + configuration. + Simple example of logging messages + + using log4net.Util; + + ILog log = LogManager.GetLogger("application-log"); + + log.InfoExt("Application Start"); + log.DebugExt("This is a debug message"); + + - + - Flushes any buffered output + The fully qualified type of the Logger class. + + + + Log a message object with the level. + + The logger on which the message is logged. + The lambda expression that gets the object to log. - Clears all buffers for the writer and causes any buffered data to be written - to the underlying device + This method first checks if this logger is INFO + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is INFO enabled, then it converts + the message object (retrieved by invocation of the provided callback) to a + string by invoking the appropriate . + It then proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + - + - Writes a character to the wrapped TextWriter + Log a message object with the level including + the stack trace of the passed + as a parameter. - the value to write to the TextWriter + The logger on which the message is logged. + The lambda expression that gets the object to log. + The exception to log, including its stack trace. - Writes a character to the wrapped TextWriter + See the form for more detailed information. + + + + + + + Log a message object with the level. //TODO + + Log a message object with the level. + + The logger on which the message is logged. + The message object to log. + + + This method first checks if this logger is INFO + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is INFO enabled, then it converts + the message object (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + - + - Writes a character buffer to the wrapped TextWriter + Log a message object with the level including + the stack trace of the passed + as a parameter. - the data buffer - the start index - the number of characters to write + The logger on which the message is logged. + The message object to log. + The exception to log, including its stack trace. - Writes a character buffer to the wrapped TextWriter + See the form for more detailed information. + + - + - Writes a string to the wrapped TextWriter + Logs a formatted message string with the level. - the value to write to the TextWriter + The logger on which the message is logged. + A String containing zero or more format items + An Object to format - Writes a string to the wrapped TextWriter + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Gets or sets the underlying . + Logs a formatted message string with the level. - - The underlying . - + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format - Gets or sets the underlying . + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - The Encoding in which the output is written + Logs a formatted message string with the level. - - The - + An that supplies culture-specific formatting information + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format - The Encoding in which the output is written + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Gets an object that controls formatting + Logs a formatted message string with the level. - - The format provider - + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format - Gets an object that controls formatting + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Gets or sets the line terminator string used by the TextWriter + Logs a formatted message string with the level. - - The line terminator to use - + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format + An Object to format - Gets or sets the line terminator string used by the TextWriter + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Constructor + Log a message object with the level. - the writer to actually write to - the error handler to report error to + The logger on which the message is logged. + The lambda expression that gets the object to log. - Create a new QuietTextWriter using a writer and error handler + This method first checks if this logger is INFO + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is INFO enabled, then it converts + the message object (retrieved by invocation of the provided callback) to a + string by invoking the appropriate . + It then proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + - + - Writes a character to the underlying writer + Log a message object with the level including + the stack trace of the passed + as a parameter. - the char to write + The logger on which the message is logged. + The lambda expression that gets the object to log. + The exception to log, including its stack trace. - Writes a character to the underlying writer + See the form for more detailed information. + + - + + Log a message object with the level. //TODO - Writes a buffer to the underlying writer + Log a message object with the level. - the buffer to write - the start index to write from - the number of characters to write + The logger on which the message is logged. + The message object to log. - Writes a buffer to the underlying writer + This method first checks if this logger is INFO + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is INFO enabled, then it converts + the message object (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + - + - Writes a string to the output. + Log a message object with the level including + the stack trace of the passed + as a parameter. - The string data to write to the output. + The logger on which the message is logged. + The message object to log. + The exception to log, including its stack trace. - Writes a string to the output. + See the form for more detailed information. + + - + - Closes the underlying output writer. + Logs a formatted message string with the level. + The logger on which the message is logged. + A String containing zero or more format items + An Object to format - Closes the underlying output writer. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - - - The error handler instance to pass all errors to - - - - - Flag to indicate if this writer is closed - - - + - Gets or sets the error handler that all errors are passed to. + Logs a formatted message string with the level. - - The error handler that all errors are passed to. - + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format - Gets or sets the error handler that all errors are passed to. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Gets a value indicating whether this writer is closed. + Logs a formatted message string with the level. - - true if this writer is closed, otherwise false. - + An that supplies culture-specific formatting information + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format - Gets a value indicating whether this writer is closed. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Constructor + Logs a formatted message string with the level. - The to actually write to. - The to report errors to. + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format - Creates a new instance of the class - with the specified and . + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Writes a character to the underlying writer and counts the number of bytes written. + Logs a formatted message string with the level. - the char to write + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format + An Object to format - Overrides implementation of . Counts - the number of bytes written. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Writes a buffer to the underlying writer and counts the number of bytes written. + Log a message object with the level. - the buffer to write - the start index to write from - the number of characters to write + The logger on which the message is logged. + The lambda expression that gets the object to log. - Overrides implementation of . Counts - the number of bytes written. + This method first checks if this logger is WARN + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is WARN enabled, then it converts + the message object (retrieved by invocation of the provided callback) to a + string by invoking the appropriate . + It then proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + - + - Writes a string to the output and counts the number of bytes written. + Log a message object with the level including + the stack trace of the passed + as a parameter. - The string data to write to the output. + The logger on which the message is logged. + The lambda expression that gets the object to log. + The exception to log, including its stack trace. - Overrides implementation of . Counts - the number of bytes written. + See the form for more detailed information. + + - - - Total number of bytes written. - - - + + Log a message object with the level. //TODO - Gets or sets the total number of bytes written. + Log a message object with the level. - - The total number of bytes written. - + The logger on which the message is logged. + The message object to log. - Gets or sets the total number of bytes written. + This method first checks if this logger is WARN + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is WARN enabled, then it converts + the message object (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + - + - A fixed size rolling buffer of logging events. + Log a message object with the level including + the stack trace of the passed + as a parameter. + The logger on which the message is logged. + The message object to log. + The exception to log, including its stack trace. - An array backed fixed size leaky bucket. + See the form for more detailed information. - Nicko Cadell - Gert Driesen + + - + - Constructor + Logs a formatted message string with the level. - The maximum number of logging events in the buffer. + The logger on which the message is logged. + A String containing zero or more format items + An Object to format - Initializes a new instance of the class with - the specified maximum number of buffered logging events. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. - The argument is not a positive integer. + + - + - Appends a to the buffer. + Logs a formatted message string with the level. - The event to append to the buffer. - The event discarded from the buffer, if the buffer is full, otherwise null. + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format - Append an event to the buffer. If the buffer still contains free space then - null is returned. If the buffer is full then an event will be dropped - to make space for the new event, the event dropped is returned. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Get and remove the oldest event in the buffer. + Logs a formatted message string with the level. - The oldest logging event in the buffer + An that supplies culture-specific formatting information + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format - Gets the oldest (first) logging event in the buffer and removes it - from the buffer. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Pops all the logging events from the buffer into an array. + Logs a formatted message string with the level. - An array of all the logging events in the buffer. + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format - Get all the events in the buffer and clear the buffer. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Clear the buffer + Logs a formatted message string with the level. + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format + An Object to format - Clear the buffer of all events. The events in the buffer are lost. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Gets the th oldest event currently in the buffer. + Log a message object with the level. - The th oldest event currently in the buffer. + The logger on which the message is logged. + The lambda expression that gets the object to log. - If is outside the range 0 to the number of events - currently in the buffer, then null is returned. + This method first checks if this logger is ERROR + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is ERROR enabled, then it converts + the message object (retrieved by invocation of the provided callback) to a + string by invoking the appropriate . + It then proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + - + - Gets the maximum size of the buffer. + Log a message object with the level including + the stack trace of the passed + as a parameter. - The maximum size of the buffer. + The logger on which the message is logged. + The lambda expression that gets the object to log. + The exception to log, including its stack trace. - Gets the maximum size of the buffer + See the form for more detailed information. + + - + + Log a message object with the level. //TODO - Gets the number of logging events in the buffer. + Log a message object with the level. - The number of logging events in the buffer. + The logger on which the message is logged. + The message object to log. - This number is guaranteed to be in the range 0 to - (inclusive). + This method first checks if this logger is ERROR + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is ERROR enabled, then it converts + the message object (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + - + - An always empty . + Log a message object with the level including + the stack trace of the passed + as a parameter. + The logger on which the message is logged. + The message object to log. + The exception to log, including its stack trace. - A singleton implementation of the - interface that always represents an empty collection. + See the form for more detailed information. - Nicko Cadell - Gert Driesen + + - + - Initializes a new instance of the class. + Logs a formatted message string with the level. + The logger on which the message is logged. + A String containing zero or more format items + An Object to format - Uses a private access modifier to enforce the singleton pattern. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Copies the elements of the to an - , starting at a particular Array index. + Logs a formatted message string with the level. - The one-dimensional - that is the destination of the elements copied from - . The Array must have zero-based - indexing. - The zero-based index in array at which - copying begins. + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format - As the collection is empty no values are copied into the array. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Returns an enumerator that can iterate through a collection. + Logs a formatted message string with the level. - - An that can be used to - iterate through the collection. - + An that supplies culture-specific formatting information + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format - As the collection is empty a is returned. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - - - The singleton instance of the empty collection. - - - + - Gets the singleton instance of the empty collection. + Logs a formatted message string with the level. - The singleton instance of the empty collection. + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format - Gets the singleton instance of the empty collection. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Gets a value indicating if access to the is synchronized (thread-safe). + Logs a formatted message string with the level. - - true if access to the is synchronized (thread-safe); otherwise, false. - + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format + An Object to format - For the this property is always true. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Gets the number of elements contained in the . + Log a message object with the level. - - The number of elements contained in the . - + The logger on which the message is logged. + The lambda expression that gets the object to log. - As the collection is empty the is always 0. + This method first checks if this logger is FATAL + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is FATAL enabled, then it converts + the message object (retrieved by invocation of the provided callback) to a + string by invoking the appropriate . + It then proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. + + - + - Gets an object that can be used to synchronize access to the . + Log a message object with the level including + the stack trace of the passed + as a parameter. - - An object that can be used to synchronize access to the . - + The logger on which the message is logged. + The lambda expression that gets the object to log. + The exception to log, including its stack trace. - As the collection is empty and thread safe and synchronized this instance is also - the object. + See the form for more detailed information. + + - + + Log a message object with the level. //TODO - An always empty . + Log a message object with the level. + The logger on which the message is logged. + The message object to log. - A singleton implementation of the - interface that always represents an empty collection. + This method first checks if this logger is FATAL + enabled by reading the value property. + This check happens always and does not depend on the + implementation. If this logger is FATAL enabled, then it converts + the message object (passed as parameter) to a string by invoking the appropriate + . It then + proceeds to call all the registered appenders in this logger + and also higher in the hierarchy depending on the value of + the additivity flag. + + WARNING Note that passing an + to this method will print the name of the + but no stack trace. To print a stack trace use the + form instead. - Nicko Cadell - Gert Driesen + + - + - Initializes a new instance of the class. + Log a message object with the level including + the stack trace of the passed + as a parameter. + The logger on which the message is logged. + The message object to log. + The exception to log, including its stack trace. - Uses a private access modifier to enforce the singleton pattern. + See the form for more detailed information. + + - + - Copies the elements of the to an - , starting at a particular Array index. + Logs a formatted message string with the level. - The one-dimensional - that is the destination of the elements copied from - . The Array must have zero-based - indexing. - The zero-based index in array at which - copying begins. + The logger on which the message is logged. + A String containing zero or more format items + An Object to format - As the collection is empty no values are copied into the array. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Returns an enumerator that can iterate through a collection. + Logs a formatted message string with the level. - - An that can be used to - iterate through the collection. - + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format - As the collection is empty a is returned. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Adds an element with the provided key and value to the - . + Logs a formatted message string with the level. - The to use as the key of the element to add. - The to use as the value of the element to add. + An that supplies culture-specific formatting information + The logger on which the message is logged. + A String containing zero or more format items + An Object array containing zero or more objects to format - As the collection is empty no new values can be added. A - is thrown if this method is called. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. - This dictionary is always empty and cannot be modified. + + - + - Removes all elements from the . + Logs a formatted message string with the level. + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format - As the collection is empty no values can be removed. A - is thrown if this method is called. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. - This dictionary is always empty and cannot be modified. + + - + - Determines whether the contains an element - with the specified key. + Logs a formatted message string with the level. - The key to locate in the . - false + The logger on which the message is logged. + A String containing zero or more format items + An Object to format + An Object to format + An Object to format - As the collection is empty the method always returns false. + The message is formatted using the String.Format method. See + for details of the syntax of the format string and the behavior + of the formatting. + + + This method does not take an object to include in the + log event. To pass an use one of the + methods instead. + + - + - Returns an enumerator that can iterate through a collection. + Manages a mapping from levels to - - An that can be used to - iterate through the collection. - - As the collection is empty a is returned. + Manages an ordered mapping from instances + to subclasses. + Nicko Cadell - + - Removes the element with the specified key from the . + Default constructor - The key of the element to remove. - As the collection is empty no values can be removed. A - is thrown if this method is called. + Initialise a new instance of . - This dictionary is always empty and cannot be modified. - - - - The singleton instance of the empty dictionary. - - + - Gets the singleton instance of the . + Add a to this mapping - The singleton instance of the . + the entry to add - Gets the singleton instance of the . + If a has previously been added + for the same then that entry will be + overwritten. - + - Gets a value indicating if access to the is synchronized (thread-safe). + Lookup the mapping for the specified level - - true if access to the is synchronized (thread-safe); otherwise, false. - + the level to lookup + the for the level or null if no mapping found - For the this property is always true. + Lookup the value for the specified level. Finds the nearest + mapping value for the level that is equal to or less than the + specified. + + + If no mapping could be found then null is returned. - + - Gets the number of elements contained in the + Initialize options - - The number of elements contained in the . - - As the collection is empty the is always 0. + Caches the sorted list of in an array - + - Gets an object that can be used to synchronize access to the . + Implementation of Properties collection for the - - An object that can be used to synchronize access to the . - - As the collection is empty and thread safe and synchronized this instance is also - the object. + Class implements a collection of properties that is specific to each thread. + The class is not synchronized as each thread has its own . + + + This class stores its properties in a slot on the named + log4net.Util.LogicalThreadContextProperties. + + + The requires a link time + for the + . + If the calling code does not have this permission then this context will be disabled. + It will not store any property values set on it. + Nicko Cadell - + - Gets a value indicating whether the has a fixed size. + Flag used to disable this context if we don't have permission to access the CallContext. - true - - - As the collection is empty always returns true. - - - + - Gets a value indicating whether the is read-only. + Constructor - true - As the collection is empty always returns true. + Initializes a new instance of the class. - + - Gets an containing the keys of the . + Remove a property - An containing the keys of the . + the key for the entry to remove - As the collection is empty a is returned. + Remove the value for the specified from the context. - + - Gets an containing the values of the . + Clear all the context properties - An containing the values of the . - As the collection is empty a is returned. + Clear all the context properties - + - Gets or sets the element with the specified key. + Get the PropertiesDictionary stored in the LocalDataStoreSlot for this thread. - The key of the element to get or set. - null + create the dictionary if it does not exist, otherwise return null if is does not exist + the properties for this thread - As the collection is empty no values can be looked up or stored. - If the index getter is called then null is returned. - A is thrown if the setter is called. + The collection returned is only to be used on the calling thread. If the + caller needs to share the collection between different threads then the + caller must clone the collection before doings so. - This dictionary is always empty and cannot be modified. - + - Contain the information obtained when parsing formatting modifiers - in conversion modifiers. + Gets the call context get data. + The peroperties dictionary stored in the call context - - Holds the formatting information extracted from the format string by - the . This is used by the - objects when rendering the output. - + The method has a + security link demand, therfore we must put the method call in a seperate method + that we can wrap in an exception handler. - Nicko Cadell - Gert Driesen - + - Defaut Constructor + Sets the call context data. + The properties. - - Initializes a new instance of the class. - + The method has a + security link demand, therfore we must put the method call in a seperate method + that we can wrap in an exception handler. - + - Constructor + The fully qualified type of the LogicalThreadContextProperties class. - - Initializes a new instance of the class - with the specified parameters. - + Used by the internal logger to record the Type of the + log message. - + - Gets or sets the minimum value. + Gets or sets the value of a property - The minimum value. + The value for the property with the specified key - Gets or sets the minimum value. + Get or set the property value for the specified. - + - Gets or sets the maximum value. + Delegate type used for LogicalThreadContextStack's callbacks. + + + + + Implementation of Stack for the - - The maximum value. - - Gets or sets the maximum value. + Implementation of Stack for the + Nicko Cadell - + - Gets or sets a flag indicating whether left align is enabled - or not. + The stack store. + + + + + The name of this within the + . + + + + + The callback used to let the register a + new instance of a . + + + + + Internal constructor - - A flag indicating whether left align is enabled or not. - - Gets or sets a flag indicating whether left align is enabled or not. + Initializes a new instance of the class. - + - Implementation of Properties collection for the + Clears all the contextual information held in this stack. - This class implements a properties collection that is thread safe and supports both - storing properties and capturing a read only copy of the current propertied. - - - This class is optimized to the scenario where the properties are read frequently - and are modified infrequently. + Clears all the contextual information held in this stack. + Only call this if you think that this thread is being reused after + a previous call execution which may not have completed correctly. + You do not need to use this method if you always guarantee to call + the method of the + returned from even in exceptional circumstances, + for example by using the using(log4net.LogicalThreadContext.Stacks["NDC"].Push("Stack_Message")) + syntax. - Nicko Cadell - + - The read only copy of the properties. + Removes the top context from this stack. + The message in the context that was removed from the top of this stack. - This variable is declared volatile to prevent the compiler and JIT from - reordering reads and writes of this thread performed on different threads. + Remove the top context from this stack, and return + it to the caller. If this stack is empty then an + empty string (not ) is returned. - - - Lock object used to synchronize updates within this instance - - - + - Constructor + Pushes a new context message into this stack. + The new context message. + + An that can be used to clean up the context stack. + - Initializes a new instance of the class. + Pushes a new context onto this stack. An + is returned that can be used to clean up this stack. This + can be easily combined with the using keyword to scope the + context. + Simple example of using the Push method with the using keyword. + + using(log4net.LogicalThreadContext.Stacks["NDC"].Push("Stack_Message")) + { + log.Warn("This should have an ThreadContext Stack message"); + } + + - + - Remove a property from the global context + Gets the current context information for this stack. - the key for the entry to remove + The current context information. + + + + Gets the current context information for this stack. + + Gets the current context information - Removing an entry from the global context properties is relatively expensive compared - with reading a value. + Gets the current context information for this stack. - - - Clear the global context properties - - - + - Get a readonly immutable copy of the properties + Get a portable version of this object - the current global context properties + the portable instance of this object - This implementation is fast because the GlobalContextProperties class - stores a readonly copy of the properties. + Get a cross thread portable version of this object - + - Gets or sets the value of a property + The number of messages in the stack - The value for the property with the specified key + The current number of messages in the stack - Reading the value for a key is faster than setting the value. - When the value is written a new read only copy of - the properties is created. + The current number of messages in the stack. That is + the number of times has been called + minus the number of times has been called. - + - Manages a mapping from levels to + Gets and sets the internal stack used by this + The internal storage stack - Manages an ordered mapping from instances - to subclasses. + This property is provided only to support backward compatability + of the . Tytpically the internal stack should not + be modified. - Nicko Cadell - + - Default constructor + Inner class used to represent a single context frame in the stack. - Initialise a new instance of . + Inner class used to represent a single context frame in the stack. - + - Add a to this mapping + Constructor - the entry to add + The message for this context. + The parent context in the chain. - If a has previously been added - for the same then that entry will be - overwritten. + Initializes a new instance of the class + with the specified message and parent context. - + - Lookup the mapping for the specified level + Get the message. - the level to lookup - the for the level or null if no mapping found + The message. - Lookup the value for the specified level. Finds the nearest - mapping value for the level that is equal to or less than the - specified. - - - If no mapping could be found then null is returned. + Get the message. - + - Initialize options + Gets the full text of the context down to the root level. + + The full text of the context down to the root level. + - Caches the sorted list of in an array + Gets the full text of the context down to the root level. - + - Implementation of Properties collection for the + Struct returned from the method. - Class implements a collection of properties that is specific to each thread. - The class is not synchronized as each thread has its own . + This struct implements the and is designed to be used + with the pattern to remove the stack frame at the end of the scope. - Nicko Cadell - + + + The depth to trim the stack to when this instance is disposed + + + + + The outer LogicalThreadContextStack. + + + Constructor + The internal stack used by the ThreadContextStack. + The depth to return the stack to when this object is disposed. - Initializes a new instance of the class. + Initializes a new instance of the class with + the specified stack and return depth. - + - Remove a property + Returns the stack to the correct depth. - the key for the entry to remove - Remove the value for the specified from the context. + Returns the stack to the correct depth. - + - Clear all the context properties + Implementation of Stacks collection for the - Clear all the context properties + Implementation of Stacks collection for the + Nicko Cadell - + - Get the PropertiesDictionary stored in the LocalDataStoreSlot for this thread. + Internal constructor - create the dictionary if it does not exist, otherwise return null if is does not exist - the properties for this thread - The collection returned is only to be used on the calling thread. If the - caller needs to share the collection between different threads then the - caller must clone the collection before doings so. + Initializes a new instance of the class. - + + + The fully qualified type of the ThreadContextStacks class. + + + Used by the internal logger to record the Type of the + log message. + + + - Gets or sets the value of a property + Gets the named thread context stack - The value for the property with the specified key + The named stack - Get or set the property value for the specified. + Gets the named thread context stack + + + + + + + Outputs log statements from within the log4net assembly. @@ -24284,15 +27523,21 @@ Nicko Cadell Gert Driesen - + + + Formats Prefix, Source, and Message in the same format as the value + sent to Console.Out and Trace.Write. + + + + Initializes a new instance of the class. - - - Uses a private access modifier to prevent instantiation of this class. - - + + + + @@ -24313,11 +27558,21 @@ - + + + Raises the LogReceived event when an internal messages is received. + + + + + + + Writes log4net internal debug messages to the standard output stream. + The message to log. @@ -24326,11 +27581,12 @@ - + Writes log4net internal debug messages to the standard output stream. + The Type that generated this message. The message to log. An exception to log. @@ -24340,11 +27596,12 @@ - + Writes log4net internal warning messages to the standard error stream. + The Type that generated this message. The message to log. @@ -24353,11 +27610,12 @@ - + Writes log4net internal warning messages to the standard error stream. + The Type that generated this message. The message to log. An exception to log. @@ -24367,11 +27625,12 @@ - + Writes log4net internal error messages to the standard error stream. + The Type that generated this message. The message to log. @@ -24380,11 +27639,12 @@ - + Writes log4net internal error messages to the standard error stream. + The Type that generated this message. The message to log. An exception to log. @@ -24440,6 +27700,44 @@ In quietMode not even errors generate any output. + + + The event raised when an internal message has been received. + + + + + The Type that generated the internal message. + + + + + The DateTime stamp of when the internal message was received. + + + + + A string indicating the severity of the internal message. + + + "log4net: ", + "log4net:ERROR ", + "log4net:WARN " + + + + + The internal log message. + + + + + The Exception related to the message. + + + Optional. Will be null if no Exception was passed. + + Gets or sets a value indicating whether log4net internal logging @@ -24514,6 +27812,11 @@ + + + + + Test if LogLog.Debug is enabled for output. @@ -24553,6 +27856,44 @@ + + + Subscribes to the LogLog.LogReceived event and stores messages + to the supplied IList instance. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Represents a native error code and message. @@ -24639,11 +27980,11 @@ Formats a message string. - Formatting options, and how to interpret the parameter. + Formatting options, and how to interpret the parameter. Location of the message definition. Message identifier for the requested message. Language identifier for the requested message. - If includes FORMAT_MESSAGE_ALLOCATE_BUFFER, the function allocates a buffer using the LocalAlloc function, and places the pointer to the buffer at the address specified in . + If includes FORMAT_MESSAGE_ALLOCATE_BUFFER, the function allocates a buffer using the LocalAlloc function, and places the pointer to the buffer at the address specified in . If the FORMAT_MESSAGE_ALLOCATE_BUFFER flag is not set, this parameter specifies the maximum number of TCHARs that can be stored in the output buffer. If FORMAT_MESSAGE_ALLOCATE_BUFFER is set, this parameter specifies the minimum number of TCHARs to allocate for an output buffer. Pointer to an array of values that are used as insert values in the formatted message. @@ -24667,7 +28008,7 @@ If the function fails, the return value is zero. To get extended error information, - call . + call . @@ -24965,7 +28306,7 @@ - The error message is printed on the standard error output stream. + The error message is processed using the LogLog sub-system by default. This policy aims at protecting an otherwise working application @@ -24974,6 +28315,7 @@ Nicko Cadell Gert Driesen + Ron Grabowski @@ -24997,6 +28339,11 @@ + + + Reset the error handler back to its initial disabled state. + + Log an Error @@ -25006,8 +28353,20 @@ The internal error code. - Prints the message and the stack trace of the exception on the standard - error output stream. + Invokes if and only if this is the first error or the first error after has been called. + + + + + + Log the very first error + + The error message. + The exception. + The internal error code. + + + Sends the error information to 's Error method. @@ -25019,8 +28378,7 @@ The exception. - Prints the message and the stack trace of the exception on the standard - error output stream. + Invokes if and only if this is the first error or the first error after has been called. @@ -25031,21 +28389,49 @@ The error message. - Print a the error message passed as parameter on the standard - error output stream. + Invokes if and only if this is the first error or the first error after has been called. + + + The date the error was recorded. + + Flag to indicate if it is the first error + + + The message recorded during the first error. + + + + + The exception recorded during the first error. + + + + + The error code recorded during the first error. + + String to prefix each message with + + + The fully qualified type of the OnlyOnceErrorHandler class. + + + Used by the internal logger to record the Type of the + log message. + + Is error logging enabled @@ -25057,6 +28443,32 @@ + + + The date the first error that trigged this error handler occured. + + + + + The message from the first error that trigged this error handler. + + + + + The exception from the first error that trigged this error handler. + + + May be . + + + + + The error code from the first error that trigged this error handler. + + + Defaults to + + A convenience class to convert property values to specific types. @@ -25176,7 +28588,7 @@ - Performs variable substitution in string from the + Performs variable substitution in string from the values of keys found in . The string on which variable substitution is performed. @@ -25229,6 +28641,15 @@ If true, ignore case; otherwise, regard case. An object of type whose value is represented by . + + + The fully qualified type of the OptionConverter class. + + + Used by the internal logger to record the Type of the + log message. + + Most of the work of the class @@ -25335,6 +28756,15 @@ + + + The fully qualified type of the PatternParser class. + + + Used by the internal logger to record the Type of the + log message. + + Get the converter registry used by this parser @@ -25395,7 +28825,7 @@ date - Used to output the date of the logging event in the local time zone. + Used to output the current date and time in the local time zone. To output the date in universal time use the %utcdate pattern. The date conversion specifier may be followed by a date format specifier enclosed @@ -25406,7 +28836,7 @@ The date format specifier admits the same syntax as the - time pattern string of the . + time pattern string of the . For better results it is recommended to use the log4net date @@ -25419,7 +28849,7 @@ These dedicated date formatters perform significantly - better than . + better than . @@ -25541,7 +28971,7 @@ The date format specifier admits the same syntax as the - time pattern string of the . + time pattern string of the . For better results it is recommended to use the log4net date @@ -25554,7 +28984,7 @@ These dedicated date formatters perform significantly - better than . + better than . @@ -25569,8 +28999,8 @@ Additional pattern converters may be registered with a specific - instance using or - . + instance using or + . See the for details on the @@ -25679,7 +29109,7 @@ - + Add a converter to this PatternString @@ -25687,7 +29117,7 @@ This version of the method is used by the configurator. - Programmatic users should use the alternative method. + Programmatic users should use the alternative method. @@ -25718,47 +29148,6 @@ - - - Wrapper class used to map converter names to converter types - - - - Wrapper class used to map converter names to converter types - - - - - - default constructor - - - - - Gets or sets the name of the conversion pattern - - - The name of the conversion pattern - - - - Gets or sets the name of the conversion pattern - - - - - - Gets or sets the type of the converter - - - The type of the converter - - - - Gets or sets the type of the converter - - - String keyed object map. @@ -26158,6 +29547,48 @@ See + + + A class to hold the key and data for a property set in the config file + + + + A class to hold the key and data for a property set in the config file + + + + + + Override Object.ToString to return sensible debug info + + string info about this object + + + + Property Key + + + Property Key + + + + Property Key. + + + + + + Property Value + + + Property Value + + + + Property Value. + + + A that ignores the message @@ -26436,7 +29867,7 @@ If the type name is fully qualified, i.e. if contains an assembly name in the type name, the type will be loaded from the system using - . + . If the type name is not fully qualified, it will be loaded from the assembly @@ -26457,7 +29888,7 @@ If the type name is fully qualified, i.e. if contains an assembly name in the type name, the type will be loaded from the system using - . + . If the type name is not fully qualified it will be loaded from the @@ -26479,7 +29910,7 @@ If the type name is fully qualified, i.e. if contains an assembly name in the type name, the type will be loaded from the system using - . + . If the type name is not fully qualified it will be loaded from the specified @@ -26548,6 +29979,20 @@ + + + Parse a string into an value + + the string to parse + out param where the parsed value is placed + true if the string was able to be parsed into an integer + + + Attempts to parse the string into an integer. If the string cannot + be parsed then this method returns false. The method does not throw an exception. + + + Lookup an application setting @@ -26600,6 +30045,15 @@ + + + The fully qualified type of the SystemInfo class. + + + Used by the internal logger to record the Type of the + log message. + + Cache the host name for the current machine @@ -26852,6 +30306,15 @@ Dump an object to a string + + + The fully qualified type of the SystemStringFormat class. + + + Used by the internal logger to record the Type of the + log message. + + Implementation of Properties collection for the @@ -26864,9 +30327,9 @@ Nicko Cadell - + - The thread local data slot to use to store a PropertiesDictionary. + Each thread will automatically have its instance. @@ -26890,6 +30353,15 @@ + + + Get the keys stored in the properties. + + + Gets the keys stored in the properties. + + a set of the defined keys + Clear all properties @@ -26904,7 +30376,7 @@ Get the PropertiesDictionary for this thread. - create the dictionary if it does not exist, otherwise return null if is does not exist + create the dictionary if it does not exist, otherwise return null if does not exist the properties for this thread @@ -27176,6 +30648,15 @@ + + + The fully qualified type of the ThreadContextStacks class. + + + Used by the internal logger to record the Type of the + log message. + + Gets the named thread context stack @@ -27256,6 +30737,11 @@ + + + Characters illegal in XML 1.0 + + Impersonate a Windows Account @@ -27518,6 +31004,29 @@ + + + Provides information about the environment the assembly has + been built for. + + + + Version of the assembly + + + Version of the framework targeted + + + Type of framework targeted + + + Does it target a client profile? + + + + Identifies the version and target for this assembly. + + The log4net Logical Thread Context. @@ -27544,6 +31053,13 @@ The Logical Thread Context is managed on a per basis. + + The requires a link time + for the + . + If the calling code does not have this permission then this context will be disabled. + It will not store any property values set on it. + Example of using the thread context properties to store a username. @@ -27617,7 +31133,7 @@ This class has static methods that are used by a client to request - a logger instance. The method is + a logger instance. The method is used to retrieve a logger. @@ -27794,7 +31310,7 @@ - Shorthand for . + Shorthand for . Get the logger for the fully qualified name of the type specified. @@ -27804,7 +31320,7 @@ - Shorthand for . + Shorthand for . Gets the logger for the fully qualified name of the type specified. @@ -27815,7 +31331,7 @@ - Shorthand for . + Shorthand for . Gets the logger for the fully qualified name of the type specified. @@ -27968,7 +31484,7 @@ Gets the for the repository specified - by the callers assembly (). + by the callers assembly (). The instance for the default repository. @@ -28007,7 +31523,7 @@ Gets the for the repository specified - by the callers assembly (). + by the callers assembly (). The instance for the default repository. @@ -28049,7 +31565,7 @@ The created will be associated with the repository - specified such that a call to will return + specified such that a call to will return the same repository instance. @@ -28070,7 +31586,7 @@ The created will be associated with the repository - specified such that a call to will return + specified such that a call to will return the same repository instance. @@ -28161,7 +31677,7 @@ The created will be associated with the repository - specified such that a call to with the + specified such that a call to with the same assembly specified will return the same repository instance. @@ -28178,7 +31694,7 @@ The created will be associated with the repository - specified such that a call to with the + specified such that a call to with the same assembly specified will return the same repository instance. @@ -28294,13 +31810,13 @@ - Puts a context value (the parameter) as identified + Puts a context value (the parameter) as identified with the parameter into the current thread's context map. If a value is already defined for the - specified then the value will be replaced. If the + specified then the value will be replaced. If the is specified as null then the key value mapping will be removed. diff --git a/lib/zookeeper/ZooKeeperNet.dll b/lib/zookeeper/ZooKeeperNet.dll index 0c3ac07..165c8a5 100644 Binary files a/lib/zookeeper/ZooKeeperNet.dll and b/lib/zookeeper/ZooKeeperNet.dll differ diff --git a/lib/zookeeper/ZooKeeperNet.pdb b/lib/zookeeper/ZooKeeperNet.pdb index 5adb72d..ec0da3f 100644 Binary files a/lib/zookeeper/ZooKeeperNet.pdb and b/lib/zookeeper/ZooKeeperNet.pdb differ diff --git a/src/Kafka/Kafka.Client/Api/TopicMetadata.cs b/src/Kafka/Kafka.Client/Api/TopicMetadata.cs index 519303a..779c424 100644 --- a/src/Kafka/Kafka.Client/Api/TopicMetadata.cs +++ b/src/Kafka/Kafka.Client/Api/TopicMetadata.cs @@ -156,7 +156,8 @@ public static PartitionMetadata ReadFrom(ByteBuffer buffer, Dictionary(-1, short.MaxValue)); var partitionId = ApiUtils.ReadIntInRange(buffer, "partition id", Tuple.Create(0, int.MaxValue)); // partition id var leaderId = buffer.GetInt(); - var leader = brokers[leaderId]; + Broker leader; + brokers.TryGetValue(leaderId, out leader); // list of all replicas var numReplicas = ApiUtils.ReadIntInRange(buffer, "number of all replicas", Tuple.Create(0, int.MaxValue)); diff --git a/src/Kafka/Kafka.Client/Common/Imported/ByteBuffer.cs b/src/Kafka/Kafka.Client/Common/Imported/ByteBuffer.cs index f20667e..6066095 100644 --- a/src/Kafka/Kafka.Client/Common/Imported/ByteBuffer.cs +++ b/src/Kafka/Kafka.Client/Common/Imported/ByteBuffer.cs @@ -1,16 +1,19 @@ namespace Kafka.Client.Common.Imported { - using System; - using System.IO; - using System.Net; - using System.Text; - - public class ByteBuffer : Stream + using log4net; + using System; + using System.IO; + using System.Net; + using System.Reflection; + using System.Text; + + public class ByteBuffer : Stream { - - #region Buffer + protected static readonly ILog Logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + #region Buffer - private int mark = -1; + private int mark = -1; private int position; diff --git a/src/Kafka/Kafka.Client/Consumers/TopicEventHandler.cs b/src/Kafka/Kafka.Client/Consumers/TopicEventHandler.cs index e2bbdef..1a8ae51 100644 --- a/src/Kafka/Kafka.Client/Consumers/TopicEventHandler.cs +++ b/src/Kafka/Kafka.Client/Consumers/TopicEventHandler.cs @@ -4,6 +4,6 @@ public interface ITopicEventHandler { - void HandleTopicEvent(List allTopics); + void HandleTopicEvent(IEnumerable allTopics); } } \ No newline at end of file diff --git a/src/Kafka/Kafka.Client/Consumers/ZookeeperConsumerConnector.cs b/src/Kafka/Kafka.Client/Consumers/ZookeeperConsumerConnector.cs index 4dad986..c8319c3 100644 --- a/src/Kafka/Kafka.Client/Consumers/ZookeeperConsumerConnector.cs +++ b/src/Kafka/Kafka.Client/Consumers/ZookeeperConsumerConnector.cs @@ -521,7 +521,7 @@ public ZKRebalancerListener( this.watcherExecutorThread.Start(); } - public void HandleChildChange(string parentPath, IList curChilds) + public void HandleChildChange(string parentPath, IEnumerable curChilds) { this.RebalanceEventTriggered(); } @@ -1056,7 +1056,7 @@ internal WildcardStreamsHandler( private readonly ZKGroupDirs dirs; - public void HandleTopicEvent(List allTopics) + public void HandleTopicEvent(IEnumerable allTopics) { Logger.Debug("Handling topic event"); var updatedTopics = allTopics.Where(topicFilter.IsTopicAllowed).ToList(); diff --git a/src/Kafka/Kafka.Client/Consumers/ZookeeperTopicEventWatcher.cs b/src/Kafka/Kafka.Client/Consumers/ZookeeperTopicEventWatcher.cs index 7bcdea7..32074d2 100644 --- a/src/Kafka/Kafka.Client/Consumers/ZookeeperTopicEventWatcher.cs +++ b/src/Kafka/Kafka.Client/Consumers/ZookeeperTopicEventWatcher.cs @@ -71,7 +71,7 @@ public ZkTopicEventListener(ZookeeperTopicEventWatcher parent) this.parent = parent; } - public void HandleChildChange(string parentPath, IList currentChilds) + public void HandleChildChange(string parentPath, IEnumerable currentChilds) { lock (this.parent.@lock) { diff --git a/src/Kafka/Kafka.Client/Kafka.Client.0.7.0.3.nupkg b/src/Kafka/Kafka.Client/Kafka.Client.0.7.0.3.nupkg new file mode 100644 index 0000000..fd0fc02 Binary files /dev/null and b/src/Kafka/Kafka.Client/Kafka.Client.0.7.0.3.nupkg differ diff --git a/src/Kafka/Kafka.Client/Kafka.Client.0.7.0.4.nupkg b/src/Kafka/Kafka.Client/Kafka.Client.0.7.0.4.nupkg new file mode 100644 index 0000000..2ce63a8 Binary files /dev/null and b/src/Kafka/Kafka.Client/Kafka.Client.0.7.0.4.nupkg differ diff --git a/src/Kafka/Kafka.Client/Kafka.Client.csproj b/src/Kafka/Kafka.Client/Kafka.Client.csproj index dc17eaa..08a8132 100644 --- a/src/Kafka/Kafka.Client/Kafka.Client.csproj +++ b/src/Kafka/Kafka.Client/Kafka.Client.csproj @@ -103,7 +103,8 @@ - ..\..\..\lib\Crc32C\Crc32C.NET.dll + ..\..\..\..\..\..\Tfs\Projects\M\MessageFromKafka\packages\Crc32C.NET.1.0.5.0\lib\net20\Crc32C.NET.dll + True ..\..\..\lib\log4Net\log4net.dll @@ -112,7 +113,8 @@ ..\packages\Newtonsoft.Json.6.0.2\lib\net40\Newtonsoft.Json.dll - ..\..\..\lib\Snappy.NET\Snappy.NET.dll + ..\..\..\..\..\..\Tfs\Projects\M\MessageFromKafka\packages\Snappy.NET.1.1.1.7\lib\net20\Snappy.NET.dll + True ..\..\..\lib\Spring.Threading\Spring.Threading.dll @@ -124,8 +126,9 @@ - - ..\..\..\lib\zookeeper\ZooKeeperNet.dll + + ..\packages\ZooKeeperNet.3.3.4.8\lib\net40\ZooKeeperNet.dll + True @@ -288,7 +291,6 @@ - diff --git a/src/Kafka/Kafka.Client/Kafka.Client.nuspec b/src/Kafka/Kafka.Client/Kafka.Client.nuspec new file mode 100644 index 0000000..c8d7193 --- /dev/null +++ b/src/Kafka/Kafka.Client/Kafka.Client.nuspec @@ -0,0 +1,18 @@ + + + + Kafka.Client + 0.7.0.4 + Kafka .NET + martijnv + martijnv + https://github.com/orthrus/kafka-net + false + This is a .NET implementation of a client for Kafka using C# for Kafka 0.8. It provides for an implementation that covers most basic functionalities to include a simple Producer and Consumer. + Copyright 2016 + apache kafka + + + + + \ No newline at end of file diff --git a/src/Kafka/Kafka.Client/Network/Transmission.cs b/src/Kafka/Kafka.Client/Network/Transmission.cs index 0f7957b..e52b613 100644 --- a/src/Kafka/Kafka.Client/Network/Transmission.cs +++ b/src/Kafka/Kafka.Client/Network/Transmission.cs @@ -46,12 +46,18 @@ internal abstract class Receive : Transmission public int ReadCompletely(Stream channel) { var totalRead = 0; + var iter = 0; while (!this.complete) { var read = this.ReadFrom(channel); Logger.DebugFormat("{0} bytes read", read); totalRead += read; + iter++; + if(iter > 1 && totalRead == 0) + { + throw new InvalidRequestException("Reading 0 bytes"); + } } return totalRead; diff --git a/src/Kafka/Kafka.Client/Properties/AssemblyInfo.cs b/src/Kafka/Kafka.Client/Properties/AssemblyInfo.cs index 786b4d4..e464034 100644 --- a/src/Kafka/Kafka.Client/Properties/AssemblyInfo.cs +++ b/src/Kafka/Kafka.Client/Properties/AssemblyInfo.cs @@ -26,8 +26,8 @@ [assembly: AssemblyCopyright("Copyright © ExactTarget 2011")] [assembly: ComVisible(false)] -[assembly: AssemblyVersion("0.7.0.3")] -[assembly: AssemblyFileVersion("0.7.0.3")] +[assembly: AssemblyVersion("0.7.0.4")] +[assembly: AssemblyFileVersion("0.7.0.4")] [assembly: InternalsVisibleTo("Kafka.Tests")] [assembly: InternalsVisibleTo("Kafka.Console")] [assembly: CLSCompliant(false)] diff --git a/src/Kafka/Kafka.Client/Utils/ZkUtils.cs b/src/Kafka/Kafka.Client/Utils/ZkUtils.cs index 0b34b5c..9d9e8df 100644 --- a/src/Kafka/Kafka.Client/Utils/ZkUtils.cs +++ b/src/Kafka/Kafka.Client/Utils/ZkUtils.cs @@ -1,665 +1,665 @@ -namespace Kafka.Client.Utils +namespace Kafka.Client.Utils { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - using System.Text; - using System.Threading; + using System; + using System.Collections.Generic; + using System.Linq; + using System.Reflection; + using System.Text; + using System.Threading; - using Kafka.Client.Clusters; - using Kafka.Client.Consumers; - using Kafka.Client.Extensions; - using Kafka.Client.ZKClient; - using Kafka.Client.ZKClient.Exceptions; - using Kafka.Client.ZKClient.Serialize; - - using Spring.Threading.Locks; - - using log4net; - - using Newtonsoft.Json; - using Newtonsoft.Json.Linq; - - using Org.Apache.Zookeeper.Data; - - public static class ZkUtils - { - private static readonly ILog Logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - public const string ConsumersPath = "/consumers"; - - public const string BrokerIdsPath = "/brokers/ids"; - - public const string BrokerTopicsPath = "/brokers/topics"; - - public const string TopicConfigPath = "/config/topics"; - - public const string TopicConfigChangesPath = "/config/changes"; - - public const string ControllerPath = "/controller"; - - public const string ControllerEpochPath = "/controller_epoch"; - - public const string ReassignPartitionsPath = "/admin/reassign_partitions"; - - public const string DeleteTopicsPath = "/admin/delete_topics"; - - public const string PreferredReplicaLeaderElectionPath = "/admin/preferred_replica_election"; - - public static string GetTopicPath(string topic) - { - return BrokerTopicsPath + "/" + topic; - } - - public static string GetTopicPartitionsPath(string topic) - { - return GetTopicPath(topic) + "/partitions"; - } - - public static string GetTopicConfigPath(string topic) - { - return TopicConfigPath + "/" + topic; - } - - public static string GetDeleteTopicPath(string topic) - { - return DeleteTopicsPath + "/" + topic; - } - - public static string GetTopicPartitionPath(string topic, int partitionId) - { - return GetTopicPartitionsPath(topic) + "/" + partitionId; - } - - public static string GetTopicPartitionLeaderAndIsrPath(string topic, int partitionId) - { - return GetTopicPartitionPath(topic, partitionId) + "/" + "state"; - } - - public static List GetSortedBrokerList(ZkClient zkClient) - { - return GetChildren(zkClient, BrokerIdsPath).Select(int.Parse).OrderBy(x => x).ToList(); - } - - public static List GetAllBrokersInCluster(ZkClient zkClient) - { - var brokerIds = GetChildrenParentMayNotExist(zkClient, BrokerIdsPath).OrderBy(x => x).ToList(); - return - brokerIds.Select(int.Parse) - .Select(id => GetBrokerInfo(zkClient, id)) - .Where(x => x != null) - .ToList(); - } - - public static int? GetLeaderForPartition(ZkClient zkClient, string topic, int partition) - { - var leaderAndIsrOpt = ReadDataMaybeNull(zkClient, GetTopicPartitionLeaderAndIsrPath(topic, partition)).Item1; - if (leaderAndIsrOpt != null) - { - return JObject.Parse(leaderAndIsrOpt).SelectToken("leader").Value(); - } - - return null; - } - - public static string GetConsumerPartitionOwnerPath(string group, string topic, int partition) - { - var topicDirs = new ZKGroupTopicDirs(group, topic); - return topicDirs.ConsumerOwnerDir + "/" + partition; - } - - /// - /// Get JSON partition to replica map from zookeeper. - /// - /// - /// - public static string ReplicaAssignmentZkData(Dictionary> map) - { - return JObject.FromObject(new { version = 1, partitions = map }).ToString(); - } - - - /// - /// make sure a persistent path exists in ZK. Create the path if not exist. - /// - /// - /// - public static void MakeSurePersistentPathExists(ZkClient client, string path) - { - if (!client.Exists(path)) - { - client.CreatePersistent(path, true); // won't throw NoNodeException or NodeExistsException - } - } - - /// - /// create the parent path - /// - /// - /// - private static void CreateParentPath(ZkClient client, string path) - { - var parentDir = path.Substring(0, path.LastIndexOf('/')); - if (parentDir.Length != 0) - { - client.CreatePersistent(parentDir, true); - } - } - - /// - /// Create an ephemeral node with the given path and data. Create parents if necessary. - /// - /// - /// - /// - private static void CreateEphemeralPath(ZkClient client, string path, string data) - { - try - { - client.CreateEphemeral(path, data); - } - catch (ZkNoNodeException) - { - CreateParentPath(client, path); - client.CreateEphemeral(path, data); - } - } - - /// - /// Create an ephemeral node with the given path and data. - /// Throw NodeExistException if node already exists. - /// - /// - /// - /// - public static void CreateEphemeralPathExpectConflict(ZkClient client, string path, string data) - { - try - { - CreateEphemeralPath(client, path, data); - } - catch (ZkNodeExistsException) - { - // this can happen when there is connection loss; make sure the Data is what we intend to write - string storedData = null; - try - { - storedData = ReadData(client, path).Item1; - } - catch (ZkNoNodeException) - { - // the node disappeared; treat as if node existed and let caller handles this - } - - if (storedData == null || storedData != data) - { - Logger.InfoFormat("Conflict in {0} Data: {1}, stored Data: {2}", path, data, storedData); - throw; - } - else - { - // otherwise, the creation succeeded, return normally - Logger.InfoFormat("{0} exists with value {1} during connection loss", path, data); - } - } - } - - /// - /// Create an ephemeral node with the given path and data. - /// Throw NodeExistsException if node already exists. - /// Handles the following ZK session timeout b_u_g - /// - /// https://issues.apache.org/jira/browse/ZOOKEEPER-1740 - /// - /// Upon receiving a NodeExistsException, read the data from the conflicted path and - /// trigger the checker function comparing the read data and the expected data, - /// If the checker function returns true then the above b_u_g might be encountered, back off and retry; - /// otherwise re-throw the exception - /// - /// - /// - /// - /// - /// - /// - public static void CreateEphemeralPathExpectConflictHandleZKBug( - ZkClient zkClient, - string path, - string data, - object expectedCallerData, - Func checker, - int backoffTime) - { - while (true) - { - try - { - CreateEphemeralPathExpectConflict(zkClient, path, data); - return; - } - catch (ZkNodeExistsException) - { - // An ephemeral node may still exist even after its corresponding session has expired - // due to a Zookeeper ug, in this case we need to retry writing until the previous node is deleted - // and hence the write succeeds without ZkNodeExistsException - var writtenData = ReadDataMaybeNull(zkClient, path).Item1; - if (writtenData != null) - { - if (checker(writtenData, expectedCallerData)) - { - Logger.InfoFormat( - "I wrote this conflicted ephemeral node [{0}] at {1} a while back in a different session, " - + "hence I will backoff for this node to be deleted by Zookeeper and retry", - data, - path); - - Thread.Sleep(backoffTime); - } - else - { - throw; - } - } - else - { - // the node disappeared; retry creating the ephemeral node immediately - } - } - } - } - - /// - /// Create an persistent node with the given path and data. Create parents if necessary. - /// - public static void CreatePersistentPath(ZkClient client, string path, string data) - { - try - { - client.CreatePersistent(path, data); - } - catch (ZkNoNodeException e) - { - CreateParentPath(client, path); - client.CreatePersistent(path, data); - } - } - - /// - /// Update the value of a persistent node with the given path and data. - /// create parrent directory if necessary. Never throw NodeExistException. - /// Return the updated path zkVersion - /// - /// - /// - /// - public static void UpdatePersistentPath(ZkClient client, string path, string data) - { - try - { - client.WriteData(path, data); - } - catch (ZkNoNodeException) - { - CreateParentPath(client, path); - try - { - client.CreatePersistent(path, data); - } - catch (ZkNodeExistsException) - { - client.WriteData(path, data); - } - } - } - - public static bool DeletePath(ZkClient client, string path) - { - try - { - return client.Delete(path); - } - catch (ZkNoNodeException) - { - // this can happen during a connection loss event, return normally - Logger.InfoFormat("{0} deleted during connection loss; This is ok. ", path); - return false; - } - } - - public static void MaybeDeletePath(string zkUrl, string dir) - { - try - { - var zk = new ZkClient(zkUrl, 30 * 1000, 30 * 1000, new ZkStringSerializer()); - zk.DeleteRecursive(dir); - zk.Dispose(); - } - catch - { - // swallow - } - } - - - public static Tuple ReadData(ZkClient client, string path) - { - var stat = new Stat(); - var dataString = client.ReadData(path, stat); - return Tuple.Create(dataString, stat); - } - - public static Tuple ReadDataMaybeNull(ZkClient client, string path) - { - var stat = new Stat(); - try - { - var obj = client.ReadData(path, stat); - return Tuple.Create(obj, stat); - } - catch (ZkNoNodeException) - { - return Tuple.Create((string)null, stat); - } - } - - public static List GetChildren(ZkClient zkClient, string path) - { - return zkClient.GetChildren(path); - } - - public static IList GetChildrenParentMayNotExist(ZkClient client, string path) - { - try - { - return client.GetChildren(path); - } - catch (ZkNoNodeException) - { - return null; - } - } - - public static bool PathExists(ZkClient client, string path) - { - return client.Exists(path); - } - - public static Cluster GetCluster(ZkClient zkClient) - { - var cluster = new Cluster(); - var nodes = GetChildrenParentMayNotExist(zkClient, BrokerIdsPath); - foreach (var node in nodes) - { - var brokerZkString = ReadData(zkClient, BrokerIdsPath + "/" + node).Item1; - cluster.Add(Broker.CreateBroker(int.Parse(node), brokerZkString)); - } - - return cluster; - } - - public static IDictionary>> GetPartitionAssignmentForTopics( - ZkClient zkClient, IList topics) - { - IDictionary>> ret = new Dictionary>>(); - foreach (var topic in topics) - { - var jsonPartitionMap = ReadDataMaybeNull(zkClient, GetTopicPath(topic)).Item1; - IDictionary> partitionMap = new Dictionary>(); - if (jsonPartitionMap != null) - { - var m = JObject.Parse(jsonPartitionMap); - var replicaMap = (IDictionary)m.Get("partitions"); - if (replicaMap != null) - { - partitionMap = replicaMap.ToDictionary( - kvp => int.Parse(kvp.Key), kvp => kvp.Value.Values().ToList()); - } - } - - Logger.DebugFormat("Partition map for /brokers/topics/{0} is {1}", topic, JObject.FromObject(partitionMap).ToString(Formatting.None)); - ret[topic] = partitionMap; - } - - return ret; - } - - public static IDictionary> GetConsumersPerTopic(ZkClient zkClient, string group) - { - var dirs = new ZKGroupDirs(group); - var consumers = GetChildrenParentMayNotExist(zkClient, dirs.ConsumerRegistryDir); - var consumerPerTopicMap = new Dictionary>(); - foreach (var consumer in consumers) - { - var topicCount = TopicCount.ConstructTopicCount(group, consumer, zkClient); - foreach (var topicAndConsumer in topicCount.GetConsumerThreadIdsPerTopic()) - { - var topic = topicAndConsumer.Key; - var consumerThreadIdSet = topicAndConsumer.Value; - foreach (var consumerThreadId in consumerThreadIdSet) - { - var curConsumers = consumerPerTopicMap.Get(topic); - if (curConsumers != null) - { - curConsumers.Add(consumerThreadId); - } - else - { - consumerPerTopicMap[topic] = new List { consumerThreadId }; - } - } - } - } - - consumerPerTopicMap = consumerPerTopicMap.ToDictionary(x => x.Key, x => x.Value.OrderBy(y => y).ToList()); - - return consumerPerTopicMap; - } - - /// - /// This API takes in a broker id, queries zookeeper for the broker metadata and returns the metadata for that broker - /// or throws an exception if the broker dies before the query to zookeeper finishes - /// - /// The zookeeper client connection - /// The broker id - /// An optional Broker object encapsulating the broker metadata - public static Broker GetBrokerInfo(ZkClient zkClient, int brokerId) - { - var brokerInfo = ReadDataMaybeNull(zkClient, BrokerIdsPath + "/" + brokerId); - if (brokerInfo != null) - { - return Broker.CreateBroker(brokerId, brokerInfo.Item1); - } - else - { - return null; - } - } - } - - internal class LeaderExistsOrChangedListener : IZkDataListener - { - private static readonly ILog Logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - - private string topic; - - private int partition; - - private ReentrantLock leaderLock; - - private ICondition leaderExistsOrChanged; - - private int? oldLeaderOpt; - - private ZkClient zkClient; - - public LeaderExistsOrChangedListener(string topic, int partition, ReentrantLock leaderLock, ICondition leaderExistsOrChanged, int? oldLeaderOpt, ZkClient zkClient) - { - this.topic = topic; - this.partition = partition; - this.leaderLock = leaderLock; - this.leaderExistsOrChanged = leaderExistsOrChanged; - this.oldLeaderOpt = oldLeaderOpt; - this.zkClient = zkClient; - } - - public void HandleDataChange(string dataPath, object data) - { - var dataPathSplited = dataPath.Split('/'); - var t = dataPathSplited[dataPathSplited.Length - 4]; - var p = int.Parse(dataPathSplited[dataPathSplited.Length - 2]); - this.leaderLock.Lock(); - - try - { - if (t == this.topic && p == this.partition) - { - if (this.oldLeaderOpt.HasValue == false) - { - Logger.DebugFormat( - "In leader existence listener on partition [{0}, {1}], leader has been created", - topic, - partition); - this.leaderExistsOrChanged.Signal(); - } - else - { - var newLeaderOpt = ZkUtils.GetLeaderForPartition(this.zkClient, t, p); - if (newLeaderOpt.HasValue && newLeaderOpt.Value != this.oldLeaderOpt.Value) - { - Logger.DebugFormat("In leader change listener on partition [{0}, {1}], leader has been moved from {2} to {3}", topic, partition, oldLeaderOpt.Value, newLeaderOpt.Value); - this.leaderExistsOrChanged.Signal(); - } - } - } - } - finally - { - this.leaderLock.Unlock(); - } - - } - - public void HandleDataDeleted(string dataPath) - { - leaderLock.Lock(); - try - { - leaderExistsOrChanged.Signal(); - } - finally - { - leaderLock.Unlock(); - } - } - } - - public class ZkStringSerializer : IZkSerializer - { - public byte[] Serialize(object data) - { - return Encoding.UTF8.GetBytes(data.ToString()); - } - - public object Deserialize(byte[] bytes) - { - if (bytes == null) - { - return null; - } - - return Encoding.UTF8.GetString(bytes); - } - } - - public class ZKGroupDirs - { - public string Group { get; set; } - - public ZKGroupDirs(string @group) - { - this.Group = @group; - } - - public string ConsumerDir - { - get - { - return ZkUtils.ConsumersPath; - } - } - - public string ConsumerGroupDir - { - get - { - return this.ConsumerDir + "/" + this.Group; - } - } - - public string ConsumerRegistryDir - { - get - { - return this.ConsumerGroupDir + "/ids"; - } - } - } - - public class ZKGroupTopicDirs : ZKGroupDirs - { - public string Topic { get; private set; } - - public ZKGroupTopicDirs(string @group, string topic) - : base(@group) - { - this.Topic = topic; - } - - public string ConsumerOffsetDir - { - get - { - return this.ConsumerGroupDir + "/offsets/" + this.Topic; - } - } - - public string ConsumerOwnerDir - { - get - { - return this.ConsumerGroupDir + "/owners/" + this.Topic; - } - } - } - - public class ZkConfig - { - public const int DefaultSessionTimeout = 6000; - - public const int DefaultConnectionTimeout = 6000; - - public const int DefaultSyncTime = 2000; - - public ZkConfig() - : this(null, DefaultSessionTimeout, DefaultConnectionTimeout, DefaultSyncTime) - { - } - - public ZkConfig(string zkconnect, int zksessionTimeoutMs, int zkconnectionTimeoutMs, int zksyncTimeMs) - { - this.ZkConnect = zkconnect; - this.ZkConnectionTimeoutMs = zkconnectionTimeoutMs; - this.ZkSessionTimeoutMs = zksessionTimeoutMs; - this.ZkSyncTimeMs = zksyncTimeMs; - } - - public string ZkConnect { get; set; } - - public int ZkSessionTimeoutMs { get; set; } - - public int ZkConnectionTimeoutMs { get; set; } - - public int ZkSyncTimeMs { get; set; } - } + using Kafka.Client.Clusters; + using Kafka.Client.Consumers; + using Kafka.Client.Extensions; + using Kafka.Client.ZKClient; + using Kafka.Client.ZKClient.Exceptions; + using Kafka.Client.ZKClient.Serialize; + + using Spring.Threading.Locks; + + using log4net; + + using Newtonsoft.Json; + using Newtonsoft.Json.Linq; + + using Org.Apache.Zookeeper.Data; + + public static class ZkUtils + { + private static readonly ILog Logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + public const string ConsumersPath = "/consumers"; + + public const string BrokerIdsPath = "/brokers/ids"; + + public const string BrokerTopicsPath = "/brokers/topics"; + + public const string TopicConfigPath = "/config/topics"; + + public const string TopicConfigChangesPath = "/config/changes"; + + public const string ControllerPath = "/controller"; + + public const string ControllerEpochPath = "/controller_epoch"; + + public const string ReassignPartitionsPath = "/admin/reassign_partitions"; + + public const string DeleteTopicsPath = "/admin/delete_topics"; + + public const string PreferredReplicaLeaderElectionPath = "/admin/preferred_replica_election"; + + public static string GetTopicPath(string topic) + { + return BrokerTopicsPath + "/" + topic; + } + + public static string GetTopicPartitionsPath(string topic) + { + return GetTopicPath(topic) + "/partitions"; + } + + public static string GetTopicConfigPath(string topic) + { + return TopicConfigPath + "/" + topic; + } + + public static string GetDeleteTopicPath(string topic) + { + return DeleteTopicsPath + "/" + topic; + } + + public static string GetTopicPartitionPath(string topic, int partitionId) + { + return GetTopicPartitionsPath(topic) + "/" + partitionId; + } + + public static string GetTopicPartitionLeaderAndIsrPath(string topic, int partitionId) + { + return GetTopicPartitionPath(topic, partitionId) + "/" + "state"; + } + + public static List GetSortedBrokerList(ZkClient zkClient) + { + return GetChildren(zkClient, BrokerIdsPath).Select(int.Parse).OrderBy(x => x).ToList(); + } + + public static List GetAllBrokersInCluster(ZkClient zkClient) + { + var brokerIds = GetChildrenParentMayNotExist(zkClient, BrokerIdsPath).OrderBy(x => x).ToList(); + return + brokerIds.Select(int.Parse) + .Select(id => GetBrokerInfo(zkClient, id)) + .Where(x => x != null) + .ToList(); + } + + public static int? GetLeaderForPartition(ZkClient zkClient, string topic, int partition) + { + var leaderAndIsrOpt = ReadDataMaybeNull(zkClient, GetTopicPartitionLeaderAndIsrPath(topic, partition)).Item1; + if (leaderAndIsrOpt != null) + { + return JObject.Parse(leaderAndIsrOpt).SelectToken("leader").Value(); + } + + return null; + } + + public static string GetConsumerPartitionOwnerPath(string group, string topic, int partition) + { + var topicDirs = new ZKGroupTopicDirs(group, topic); + return topicDirs.ConsumerOwnerDir + "/" + partition; + } + + /// + /// Get JSON partition to replica map from zookeeper. + /// + /// + /// + public static string ReplicaAssignmentZkData(Dictionary> map) + { + return JObject.FromObject(new { version = 1, partitions = map }).ToString(); + } + + + /// + /// make sure a persistent path exists in ZK. Create the path if not exist. + /// + /// + /// + public static void MakeSurePersistentPathExists(ZkClient client, string path) + { + if (!client.Exists(path)) + { + client.CreatePersistent(path, true); // won't throw NoNodeException or NodeExistsException + } + } + + /// + /// create the parent path + /// + /// + /// + private static void CreateParentPath(ZkClient client, string path) + { + var parentDir = path.Substring(0, path.LastIndexOf('/')); + if (parentDir.Length != 0) + { + client.CreatePersistent(parentDir, true); + } + } + + /// + /// Create an ephemeral node with the given path and data. Create parents if necessary. + /// + /// + /// + /// + private static void CreateEphemeralPath(ZkClient client, string path, string data) + { + try + { + client.CreateEphemeral(path, data); + } + catch (ZkNoNodeException) + { + CreateParentPath(client, path); + client.CreateEphemeral(path, data); + } + } + + /// + /// Create an ephemeral node with the given path and data. + /// Throw NodeExistException if node already exists. + /// + /// + /// + /// + public static void CreateEphemeralPathExpectConflict(ZkClient client, string path, string data) + { + try + { + CreateEphemeralPath(client, path, data); + } + catch (ZkNodeExistsException) + { + // this can happen when there is connection loss; make sure the Data is what we intend to write + string storedData = null; + try + { + storedData = ReadData(client, path).Item1; + } + catch (ZkNoNodeException) + { + // the node disappeared; treat as if node existed and let caller handles this + } + + if (storedData == null || storedData != data) + { + Logger.InfoFormat("Conflict in {0} Data: {1}, stored Data: {2}", path, data, storedData); + throw; + } + else + { + // otherwise, the creation succeeded, return normally + Logger.InfoFormat("{0} exists with value {1} during connection loss", path, data); + } + } + } + + /// + /// Create an ephemeral node with the given path and data. + /// Throw NodeExistsException if node already exists. + /// Handles the following ZK session timeout b_u_g + /// + /// https://issues.apache.org/jira/browse/ZOOKEEPER-1740 + /// + /// Upon receiving a NodeExistsException, read the data from the conflicted path and + /// trigger the checker function comparing the read data and the expected data, + /// If the checker function returns true then the above b_u_g might be encountered, back off and retry; + /// otherwise re-throw the exception + /// + /// + /// + /// + /// + /// + /// + public static void CreateEphemeralPathExpectConflictHandleZKBug( + ZkClient zkClient, + string path, + string data, + object expectedCallerData, + Func checker, + int backoffTime) + { + while (true) + { + try + { + CreateEphemeralPathExpectConflict(zkClient, path, data); + return; + } + catch (ZkNodeExistsException) + { + // An ephemeral node may still exist even after its corresponding session has expired + // due to a Zookeeper ug, in this case we need to retry writing until the previous node is deleted + // and hence the write succeeds without ZkNodeExistsException + var writtenData = ReadDataMaybeNull(zkClient, path).Item1; + if (writtenData != null) + { + if (checker(writtenData, expectedCallerData)) + { + Logger.InfoFormat( + "I wrote this conflicted ephemeral node [{0}] at {1} a while back in a different session, " + + "hence I will backoff for this node to be deleted by Zookeeper and retry", + data, + path); + + Thread.Sleep(backoffTime); + } + else + { + throw; + } + } + else + { + // the node disappeared; retry creating the ephemeral node immediately + } + } + } + } + + /// + /// Create an persistent node with the given path and data. Create parents if necessary. + /// + public static void CreatePersistentPath(ZkClient client, string path, string data) + { + try + { + client.CreatePersistent(path, data); + } + catch (ZkNoNodeException e) + { + CreateParentPath(client, path); + client.CreatePersistent(path, data); + } + } + + /// + /// Update the value of a persistent node with the given path and data. + /// create parrent directory if necessary. Never throw NodeExistException. + /// Return the updated path zkVersion + /// + /// + /// + /// + public static void UpdatePersistentPath(ZkClient client, string path, string data) + { + try + { + client.WriteData(path, data); + } + catch (ZkNoNodeException) + { + CreateParentPath(client, path); + try + { + client.CreatePersistent(path, data); + } + catch (ZkNodeExistsException) + { + client.WriteData(path, data); + } + } + } + + public static bool DeletePath(ZkClient client, string path) + { + try + { + return client.Delete(path); + } + catch (ZkNoNodeException) + { + // this can happen during a connection loss event, return normally + Logger.InfoFormat("{0} deleted during connection loss; This is ok. ", path); + return false; + } + } + + public static void MaybeDeletePath(string zkUrl, string dir) + { + try + { + var zk = new ZkClient(zkUrl, 30 * 1000, 30 * 1000, new ZkStringSerializer()); + zk.DeleteRecursive(dir); + zk.Dispose(); + } + catch + { + // swallow + } + } + + + public static Tuple ReadData(ZkClient client, string path) + { + var stat = new Stat(); + var dataString = client.ReadData(path, stat); + return Tuple.Create(dataString, stat); + } + + public static Tuple ReadDataMaybeNull(ZkClient client, string path) + { + var stat = new Stat(); + try + { + var obj = client.ReadData(path, stat); + return Tuple.Create(obj, stat); + } + catch (ZkNoNodeException) + { + return Tuple.Create((string)null, stat); + } + } + + public static IEnumerable GetChildren(ZkClient zkClient, string path) + { + return zkClient.GetChildren(path); + } + + public static IEnumerable GetChildrenParentMayNotExist(ZkClient client, string path) + { + try + { + return client.GetChildren(path); + } + catch (ZkNoNodeException) + { + return null; + } + } + + public static bool PathExists(ZkClient client, string path) + { + return client.Exists(path); + } + + public static Cluster GetCluster(ZkClient zkClient) + { + var cluster = new Cluster(); + var nodes = GetChildrenParentMayNotExist(zkClient, BrokerIdsPath); + foreach (var node in nodes) + { + var brokerZkString = ReadData(zkClient, BrokerIdsPath + "/" + node).Item1; + cluster.Add(Broker.CreateBroker(int.Parse(node), brokerZkString)); + } + + return cluster; + } + + public static IDictionary>> GetPartitionAssignmentForTopics( + ZkClient zkClient, IList topics) + { + IDictionary>> ret = new Dictionary>>(); + foreach (var topic in topics) + { + var jsonPartitionMap = ReadDataMaybeNull(zkClient, GetTopicPath(topic)).Item1; + IDictionary> partitionMap = new Dictionary>(); + if (jsonPartitionMap != null) + { + var m = JObject.Parse(jsonPartitionMap); + var replicaMap = (IDictionary)m.Get("partitions"); + if (replicaMap != null) + { + partitionMap = replicaMap.ToDictionary( + kvp => int.Parse(kvp.Key), kvp => kvp.Value.Values().ToList()); + } + } + + Logger.DebugFormat("Partition map for /brokers/topics/{0} is {1}", topic, JObject.FromObject(partitionMap).ToString(Formatting.None)); + ret[topic] = partitionMap; + } + + return ret; + } + + public static IDictionary> GetConsumersPerTopic(ZkClient zkClient, string group) + { + var dirs = new ZKGroupDirs(group); + var consumers = GetChildrenParentMayNotExist(zkClient, dirs.ConsumerRegistryDir); + var consumerPerTopicMap = new Dictionary>(); + foreach (var consumer in consumers) + { + var topicCount = TopicCount.ConstructTopicCount(group, consumer, zkClient); + foreach (var topicAndConsumer in topicCount.GetConsumerThreadIdsPerTopic()) + { + var topic = topicAndConsumer.Key; + var consumerThreadIdSet = topicAndConsumer.Value; + foreach (var consumerThreadId in consumerThreadIdSet) + { + var curConsumers = consumerPerTopicMap.Get(topic); + if (curConsumers != null) + { + curConsumers.Add(consumerThreadId); + } + else + { + consumerPerTopicMap[topic] = new List { consumerThreadId }; + } + } + } + } + + consumerPerTopicMap = consumerPerTopicMap.ToDictionary(x => x.Key, x => x.Value.OrderBy(y => y).ToList()); + + return consumerPerTopicMap; + } + + /// + /// This API takes in a broker id, queries zookeeper for the broker metadata and returns the metadata for that broker + /// or throws an exception if the broker dies before the query to zookeeper finishes + /// + /// The zookeeper client connection + /// The broker id + /// An optional Broker object encapsulating the broker metadata + public static Broker GetBrokerInfo(ZkClient zkClient, int brokerId) + { + var brokerInfo = ReadDataMaybeNull(zkClient, BrokerIdsPath + "/" + brokerId); + if (brokerInfo != null) + { + return Broker.CreateBroker(brokerId, brokerInfo.Item1); + } + else + { + return null; + } + } + } + + internal class LeaderExistsOrChangedListener : IZkDataListener + { + private static readonly ILog Logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + + private string topic; + + private int partition; + + private ReentrantLock leaderLock; + + private ICondition leaderExistsOrChanged; + + private int? oldLeaderOpt; + + private ZkClient zkClient; + + public LeaderExistsOrChangedListener(string topic, int partition, ReentrantLock leaderLock, ICondition leaderExistsOrChanged, int? oldLeaderOpt, ZkClient zkClient) + { + this.topic = topic; + this.partition = partition; + this.leaderLock = leaderLock; + this.leaderExistsOrChanged = leaderExistsOrChanged; + this.oldLeaderOpt = oldLeaderOpt; + this.zkClient = zkClient; + } + + public void HandleDataChange(string dataPath, object data) + { + var dataPathSplited = dataPath.Split('/'); + var t = dataPathSplited[dataPathSplited.Length - 4]; + var p = int.Parse(dataPathSplited[dataPathSplited.Length - 2]); + this.leaderLock.Lock(); + + try + { + if (t == this.topic && p == this.partition) + { + if (this.oldLeaderOpt.HasValue == false) + { + Logger.DebugFormat( + "In leader existence listener on partition [{0}, {1}], leader has been created", + topic, + partition); + this.leaderExistsOrChanged.Signal(); + } + else + { + var newLeaderOpt = ZkUtils.GetLeaderForPartition(this.zkClient, t, p); + if (newLeaderOpt.HasValue && newLeaderOpt.Value != this.oldLeaderOpt.Value) + { + Logger.DebugFormat("In leader change listener on partition [{0}, {1}], leader has been moved from {2} to {3}", topic, partition, oldLeaderOpt.Value, newLeaderOpt.Value); + this.leaderExistsOrChanged.Signal(); + } + } + } + } + finally + { + this.leaderLock.Unlock(); + } + + } + + public void HandleDataDeleted(string dataPath) + { + leaderLock.Lock(); + try + { + leaderExistsOrChanged.Signal(); + } + finally + { + leaderLock.Unlock(); + } + } + } + + public class ZkStringSerializer : IZkSerializer + { + public byte[] Serialize(object data) + { + return Encoding.UTF8.GetBytes(data.ToString()); + } + + public object Deserialize(byte[] bytes) + { + if (bytes == null) + { + return null; + } + + return Encoding.UTF8.GetString(bytes); + } + } + + public class ZKGroupDirs + { + public string Group { get; set; } + + public ZKGroupDirs(string @group) + { + this.Group = @group; + } + + public string ConsumerDir + { + get + { + return ZkUtils.ConsumersPath; + } + } + + public string ConsumerGroupDir + { + get + { + return this.ConsumerDir + "/" + this.Group; + } + } + + public string ConsumerRegistryDir + { + get + { + return this.ConsumerGroupDir + "/ids"; + } + } + } + + public class ZKGroupTopicDirs : ZKGroupDirs + { + public string Topic { get; private set; } + + public ZKGroupTopicDirs(string @group, string topic) + : base(@group) + { + this.Topic = topic; + } + + public string ConsumerOffsetDir + { + get + { + return this.ConsumerGroupDir + "/offsets/" + this.Topic; + } + } + + public string ConsumerOwnerDir + { + get + { + return this.ConsumerGroupDir + "/owners/" + this.Topic; + } + } + } + + public class ZkConfig + { + public const int DefaultSessionTimeout = 6000; + + public const int DefaultConnectionTimeout = 6000; + + public const int DefaultSyncTime = 2000; + + public ZkConfig() + : this(null, DefaultSessionTimeout, DefaultConnectionTimeout, DefaultSyncTime) + { + } + + public ZkConfig(string zkconnect, int zksessionTimeoutMs, int zkconnectionTimeoutMs, int zksyncTimeMs) + { + this.ZkConnect = zkconnect; + this.ZkConnectionTimeoutMs = zkconnectionTimeoutMs; + this.ZkSessionTimeoutMs = zksessionTimeoutMs; + this.ZkSyncTimeMs = zksyncTimeMs; + } + + public string ZkConnect { get; set; } + + public int ZkSessionTimeoutMs { get; set; } + + public int ZkConnectionTimeoutMs { get; set; } + + public int ZkSyncTimeMs { get; set; } + } } \ No newline at end of file diff --git a/src/Kafka/Kafka.Client/ZKClient/Exceptions/ZkException.cs b/src/Kafka/Kafka.Client/ZKClient/Exceptions/ZkException.cs index 125bf6a..62a70e1 100644 --- a/src/Kafka/Kafka.Client/ZKClient/Exceptions/ZkException.cs +++ b/src/Kafka/Kafka.Client/ZKClient/Exceptions/ZkException.cs @@ -22,7 +22,7 @@ public ZkException(string message, Exception innerException) public static ZkException Create(KeeperException e) { - switch (e.GetCode()) + switch (e.ErrorCode) { case KeeperException.Code.NONODE: return new ZkNoNodeException(e.Message, e); diff --git a/src/Kafka/Kafka.Client/ZKClient/IZkChildListener.cs b/src/Kafka/Kafka.Client/ZKClient/IZkChildListener.cs index 65c8513..4c61220 100644 --- a/src/Kafka/Kafka.Client/ZKClient/IZkChildListener.cs +++ b/src/Kafka/Kafka.Client/ZKClient/IZkChildListener.cs @@ -17,6 +17,6 @@ public interface IZkChildListener /// /// /// - void HandleChildChange(string parentPath, IList currentChilds); + void HandleChildChange(string parentPath, IEnumerable currentChilds); } } \ No newline at end of file diff --git a/src/Kafka/Kafka.Client/ZKClient/IZkConnection.cs b/src/Kafka/Kafka.Client/ZKClient/IZkConnection.cs index c9dd1df..099737d 100644 --- a/src/Kafka/Kafka.Client/ZKClient/IZkConnection.cs +++ b/src/Kafka/Kafka.Client/ZKClient/IZkConnection.cs @@ -17,7 +17,7 @@ public interface IZkConnection : IDisposable bool Exists(string path, bool watch); - List GetChildren(string path, bool watch); + IEnumerable GetChildren(string path, bool watch); byte[] ReadData(string path, Stat stat, bool watch); diff --git a/src/Kafka/Kafka.Client/ZKClient/ZkClient.cs b/src/Kafka/Kafka.Client/ZKClient/ZkClient.cs index eca6791..e37c636 100644 --- a/src/Kafka/Kafka.Client/ZKClient/ZkClient.cs +++ b/src/Kafka/Kafka.Client/ZKClient/ZkClient.cs @@ -7,6 +7,7 @@ using System.Reflection; using System.Text; using System.Threading; + using System.Linq; using Kafka.Client.Utils; using Kafka.Client.ZKClient.Exceptions; @@ -88,7 +89,7 @@ public ZkClient(IZkConnection zkConnection, int connectionTimeout, IZkSerializer this.Connect(connectionTimeout, this); } - public List SubscribeChildChanges(string path, IZkChildListener listener) + public IEnumerable SubscribeChildChanges(string path, IZkChildListener listener) { lock (_childListener) { @@ -368,12 +369,12 @@ private void FireAllEvents() } } - public List GetChildren(string path) + public IEnumerable GetChildren(string path) { return this.GetChildren(path, this.HasListeners(path)); } - protected List GetChildren(string path, bool watch) + protected IEnumerable GetChildren(string path, bool watch) { return RetryUntilConnected(() => _connection.GetChildren(path, watch)); } @@ -387,7 +388,7 @@ public int CountChildren(string path) { try { - return GetChildren(path).Count; + return GetChildren(path).Count(); } catch (ZkNoNodeException) { @@ -475,8 +476,8 @@ private bool HasListeners(string path) } public bool DeleteRecursive(String path) - { - List children; + { + IEnumerable children; try { children = GetChildren(path, false); @@ -838,7 +839,7 @@ public void WatchForData(string path) /// /// /// - public List WatchForChilds(string path) + public IEnumerable WatchForChilds(string path) { if (_zookeeperEventThread != null && Thread.CurrentThread == _zookeeperEventThread) { @@ -934,8 +935,7 @@ public void Dispose() ShutdownTrigger = true; _eventThread.Interrupt(); _eventThread.Join(2000); - _connection.Dispose(); - _connection = null; + } catch (ThreadInterruptedException e) { @@ -946,7 +946,10 @@ public void Dispose() EventLock.Unlock(); } - Logger.Debug("Closing ZkClient...done"); + _connection.Dispose(); + _connection = null; + + Logger.Debug("Closing ZkClient...done"); } private void Reconnect() diff --git a/src/Kafka/Kafka.Client/ZKClient/ZkConnection.cs b/src/Kafka/Kafka.Client/ZKClient/ZkConnection.cs index 98538cf..0e5e296 100644 --- a/src/Kafka/Kafka.Client/ZKClient/ZkConnection.cs +++ b/src/Kafka/Kafka.Client/ZKClient/ZkConnection.cs @@ -98,7 +98,7 @@ public bool Exists(string path, bool watch) return this._zk.Exists(path, watch) != null; } - public List GetChildren(string path, bool watch) + public IEnumerable GetChildren(string path, bool watch) { return this._zk.GetChildren(path, watch); } diff --git a/src/Kafka/Kafka.Client/packages.config b/src/Kafka/Kafka.Client/packages.config index d96578d..d0bc7e1 100644 --- a/src/Kafka/Kafka.Client/packages.config +++ b/src/Kafka/Kafka.Client/packages.config @@ -3,5 +3,6 @@ - + + \ No newline at end of file diff --git a/src/Kafka/Kafka.Tests/Kafka.Tests.csproj b/src/Kafka/Kafka.Tests/Kafka.Tests.csproj index 6d85093..715316d 100644 --- a/src/Kafka/Kafka.Tests/Kafka.Tests.csproj +++ b/src/Kafka/Kafka.Tests/Kafka.Tests.csproj @@ -37,9 +37,8 @@ kafkaclient.snk - - - False + + ..\..\..\lib\log4Net\log4net.dll @@ -55,9 +54,8 @@ ..\packages\xunit.1.9.2\lib\net20\xunit.dll - - - False + + ..\..\..\lib\zookeeper\ZooKeeperNet.dll @@ -118,6 +116,6 @@ - + --> \ No newline at end of file diff --git a/src/Kafka/packages/Snappy.NET.1.1.1.7/Snappy.NET.1.1.1.7.nupkg b/src/Kafka/packages/Snappy.NET.1.1.1.7/Snappy.NET.1.1.1.7.nupkg new file mode 100644 index 0000000..ca69524 Binary files /dev/null and b/src/Kafka/packages/Snappy.NET.1.1.1.7/Snappy.NET.1.1.1.7.nupkg differ diff --git a/src/Kafka/packages/Snappy.NET.1.1.1.7/lib/net20/Snappy.NET.dll b/src/Kafka/packages/Snappy.NET.1.1.1.7/lib/net20/Snappy.NET.dll new file mode 100644 index 0000000..47ec7a0 Binary files /dev/null and b/src/Kafka/packages/Snappy.NET.1.1.1.7/lib/net20/Snappy.NET.dll differ diff --git a/src/Kafka/packages/Snappy.NET.1.1.1.7/lib/net20/Snappy.NET.xml b/src/Kafka/packages/Snappy.NET.1.1.1.7/lib/net20/Snappy.NET.xml new file mode 100644 index 0000000..aa16150 --- /dev/null +++ b/src/Kafka/packages/Snappy.NET.1.1.1.7/lib/net20/Snappy.NET.xml @@ -0,0 +1,389 @@ + + + + Snappy.NET + + + + + Straightforward wrapper around the underlying native Snappy library. + You can compress, uncompress, and validate fixed-size buffers without framing overhead. + Methods of this class forward their parameters directly to the native code without unnecessary buffer copying. + + + + + Compresses byte buffer using Snappy compression. + + Input buffer containing data to be compressed. + Offset into the input buffer where input data is located. + Size of input data in the input buffer. Zero-length input is allowed. There's no maximum input size. + + Output buffer where compressed data will be stored. + Buffer length minus outOffset must be equal or higher than return value of GetMaxCompressedLength method. + + Offset into the output buffer where compressed data will be stored. + Length of compressed data written into the output buffer. + + + + Compresses byte buffer using Snappy compression. + + Input buffer containing data to be compressed. Zero-length input is allowed. + Compressed data. + + + + Decompresses data previously compressed with Snappy. + + Input buffer containing compressed data. + Offset of compressed data within the input buffer. + Length of compressed data within the input buffer. + + Output buffer where decompressed data will be written. + Buffer length minus outOffset must be equal or higher than return value of GetUncompressedLength method. + + Offset into the output buffer where decompressed data will be stored. + Length of decompressed data written into the output buffer. + + + + Decompresses data previously compressed with Snappy. + + Input buffer containing compressed data. + Decompressed data. + + + + Estimates maximum length of compressed data. + Note that compressed data may be slightly larger than uncompressed data in some extreme cases of uncompressible data. + + Length of uncompressed data used as a basis for calculation of maximum length of compressed data. + Maximum length of compressed data given input of length inLength. + + + + Retrieves length of uncompressed data for given buffer of compressed data. This is O(1) lookup + that merely parses first few bytes of the compressed buffer where the length has been recorded during compression. + + Input buffer containing compressed data. + Offset where compressed data is located in the input buffer. + Length of compressed data in the input buffer. + Exact length of uncompressed data encoded in the input buffer. + + + + Retrieves length of uncompressed data for given buffer of compressed data. This is O(1) lookup + that merely parses first few bytes of the compressed buffer where the length has been recorded during compression. + + Input buffer containing compressed data. + Exact length of uncompressed data encoded in the input buffer. + + + + Checks integrity of compressed data. This method performs sanity checks that ensure that the buffer can be decompressed. + It doesn't check integrity of data. It merely ensures that decompression will succeed with _some_ result. + CRC or other data integrity checks can be provided by higher level protocols like the Snappy framing format. + + Input buffer containing compressed data. + Offset where compressed data is located in the input buffer. + Length of compressed data in the input buffer. + True if the buffer contains valid Snappy compressed block. False otherwise. + + + + Checks integrity of compressed data. This method performs sanity checks that ensure that the buffer can be decompressed. + It doesn't check integrity of data. It merely ensures that decompression will succeed with _some_ result. + CRC or other data integrity checks can be provided by higher level protocols like the Snappy framing format. + + Input buffer containing compressed data. + True if the buffer contains valid Snappy compressed block. False otherwise. + + + + Represents single Snappy frame that conforms to Snappy framing format. + + + + + Maximum size of uncompressed data in Snappy frame. It's 64KB in current version of the format. + + + + + Stream identifier text. It is found in ASCII in identifier frame that leads the stream of Snappy frames. + + + + + Create new Snappy frame. Frame is initialized to zero-length padding frame by default. + + + + + Resets this frame to stream identifier frame. First frame in the stream must be identifier frame. + + + + + Resets this frame to padding frame of specified size. + + Size of padding data excluding the 4 bytes of frame header. Maximum padding size is 16MB. + + + + Resets this frame to contain compressed data. + + Uncompressed data that is compressed by this method before being stored in the frame. Maximum data size is 64KB. + + + + Resets this frame to contain compressed data. + + Input buffer containing uncompressed data that is compressed by this method before being stored in the frame. + Offset of uncompressed data in the input buffer. + Size of uncompressed data in the input buffer. Maximum data size is 64KB. + + + + Resets this frame to contain uncompressed data. + + Uncompressed data to store in the frame. Maximum data size is 64KB. + + + + Resets this frame to contain uncompressed data. + + Input buffer containing uncompressed data to be stored in this frame. + Offset of uncompressed data in the input buffer. + Size of uncompressed data in the input buffer. Maximum data size is 64KB. + + + + Retrieves data from the frame. Data is uncompressed before being stored in the output buffer. + CRC of the data is checked and CRC failure results in exception. + + Output buffer where uncompressed data is stored. It must be at least DataLength bytes long. + + + + Retrieves data from the frame. Data is uncompressed before being stored in the output buffer. + CRC of the data is checked and CRC failure results in exception. + + Output buffer where uncompressed data is stored. Buffer length minus offset must be at least DataLength bytes. + Offset into the output buffer where uncompressed data will be stored. + + + + Retrieves Snappy frame from underlying stream. Retrieved frame data is stored in properties of this object. + Return value indicates end of stream. Exceptions indicate data integrity errors and underlying stream errors. + + Underlying stream that will be read by this method. + + True if frame was successfully retrieved. False if there are no more frames in the stream, i.e. the end of stream has been reached. + Note that reaching the end of stream in the middle of the frame is considered an error and causes exception instead. + + + + + Writes the frame into the underlying stream. + + Underlying stream where the frame will be written. + + + + Type of Snappy frame. It contains decoded frame type upon deserialization. It is set automatically by Set* methods. + + + + + Data checksum is present in compressed and uncompressed frames. Otherwise it is zero. + It is computed automatically by Set* methods. + It is automatically checked when reading data through Data property or GetData method. + It is CRC-32C (Castagnoli) of the uncompressed data with final CRC obfuscated + with transformation ((crc >> 15) | (crc << 17)) + 0xa282ead8. + + + + + Length of uncompressed data for data frames. Querying this property takes O(1) time. + For compressed and uncompressed data, data length is never larger than 64KB. + For padding frames, this property is equal to the length of padding data. + Identification frame has data length of 6. + Data length is automatically set by Set* methods and upon frame deserialization. + + + + + Uncompressed data in the frame. It is available only for frame type Compressed or Uncompressed. + Querying this property triggers CRC check of the data, which might cause exceptions. + Returned data is never larger than 64KB. + + + + + Type of Snappy frame. + + + + + Supported compressed frame containing Snappy compressed data. + + + + + Supported uncompressed frame containing plain data. + + + + + Beginning of the range of unsupported frame types reserved for future use. Exception is thrown if any such frame type is encountered. + + + + + End of the range of unsupported frame types reserved for future use. Exception is thrown if any such frame type is encountered. + + + + + Beginning of the range of unsupported frame types that are safe to skip. If encountered on input, data in these frames is skipped. + + + + + End of the range of unsupported frame types that are safe to skip. If encountered on input, data in these frames is skipped. + + + + + Padding frame. Data in this frame is ignored. Padding frames can be used for alignment purposes. + + + + + Stream identifier frame. This frame contains text "sNaPpY". + + + + + Compression stream similar to GZipStream except this one uses Snappy compression. + This stream uses standard Snappy framing format that supports streams of unbounded size + and includes CRC checksums of all transmitted data. + This stream can operate in one of two modes: compression or decompression. + When compressing, use Write* methods. When decompressing, use Read* methods. + If SnappyStream is opened for compression and immediately closed, the resulting stream + will be a valid Snappy stream containing zero bytes of uncompressed data. + + + + + Creates new SnappyStream using specified mode of operation. + + Underlying stream holding compressed data. It is automatically closed when SnappyStream is closed. + + Use mode Compress if SnappyStream is used to compress data and write it to the underlying stream. + Use mode Decompress if SnappyStream is used to decompress data that is retrieved in compressed form from the underlying stream. + + + + + Creates new SnappyStream using specified mode of operation with an option to leave the underlying stream open. + + Underlying stream holding compressed data. + + Use mode Compress if SnappyStream is used to compress data and write it to the underlying stream. + Use mode Decompress if SnappyStream is used to decompress data that is retrieved in compressed form from the underlying stream. + + False to close the underlying stream when SnappyStream is closed. True to leave the underlying stream open. + + + + Dispose the stream. Remaining data is flushed and underlying stream is closed. + + True to release both managed and unmanaged resources. False to release only unmanaged resources. + + + + Reads uncompressed data from underlying compressed stream. + + Output buffer where uncompressed data will be written. + Offset into the output buffer where uncompressed data will be written. + Maximum size of uncompressed data to read. + + Amount of data actually stored in the output buffer. + This might be less than the count parameter if end of stream is encountered. + Return value is zero if there is no more data in the stream. + + + + + Reads single byte from the underlying stream. + + Byte read from the stream or -1 if end of stream has been reached. + + + + Compresses given uncompressed data and writes the compressed data to the underlying stream. + This method will buffer some of the data in order to compress 64KB at a time. + Use Flush method to write the data to the underlying stream immediately. + + Input buffer containing uncompressed data to be compressed and written to the underlying stream. + Offset into the input buffer where uncompressed data is located. + Length of the uncompressed data in the input buffer. Zero-length data has no effect on the stream. + + + + Writes single byte of uncompressed data to the stream and queues it for compression. + This method will buffer data in order to compress 64KB at a time. + Use Flush method to write the data to the underlying stream immediately. + + Byte of uncompressed data to be added to the stream. + + + + Flushes all data buffered by previous calls to Write* methods. + Remaining data is compressed and written to the underlying stream. + + + + + Sets the length of the current stream. Not supported in SnappyStream. + + The desired length of the current stream in bytes. + + + + Sets the position within the current stream. Not supported in SnappyStream. + + A byte offset relative to the origin parameter. + A value of type SeekOrigin indicating the reference point used to obtain the new position. + + + + + Gets a value indicating whether the current stream supports reading. True for decompression stream. + + + + + Gets a value indicating whether the current stream supports writing. True for compression stream. + + + + + Gets a value indicating whether the current stream supports seeking. Always false for SnappyStream. + + + + + Gets the length in bytes of the stream. Not supported in SnappyStream. + + + + + Gets or sets the position within the current stream. Not supported in SnappyStream. + + + + diff --git a/src/Kafka/packages/Snappy.NET.1.1.1.7/lib/net45/Snappy.NET.dll b/src/Kafka/packages/Snappy.NET.1.1.1.7/lib/net45/Snappy.NET.dll new file mode 100644 index 0000000..d9f2df3 Binary files /dev/null and b/src/Kafka/packages/Snappy.NET.1.1.1.7/lib/net45/Snappy.NET.dll differ diff --git a/src/Kafka/packages/Snappy.NET.1.1.1.7/lib/net45/Snappy.NET.xml b/src/Kafka/packages/Snappy.NET.1.1.1.7/lib/net45/Snappy.NET.xml new file mode 100644 index 0000000..6ac4c4e --- /dev/null +++ b/src/Kafka/packages/Snappy.NET.1.1.1.7/lib/net45/Snappy.NET.xml @@ -0,0 +1,461 @@ + + + + Snappy.NET + + + + + Straightforward wrapper around the underlying native Snappy library. + You can compress, uncompress, and validate fixed-size buffers without framing overhead. + Methods of this class forward their parameters directly to the native code without unnecessary buffer copying. + + + + + Compresses byte buffer using Snappy compression. + + Input buffer containing data to be compressed. + Offset into the input buffer where input data is located. + Size of input data in the input buffer. Zero-length input is allowed. There's no maximum input size. + + Output buffer where compressed data will be stored. + Buffer length minus outOffset must be equal or higher than return value of GetMaxCompressedLength method. + + Offset into the output buffer where compressed data will be stored. + Length of compressed data written into the output buffer. + + + + Compresses byte buffer using Snappy compression. + + Input buffer containing data to be compressed. Zero-length input is allowed. + Compressed data. + + + + Decompresses data previously compressed with Snappy. + + Input buffer containing compressed data. + Offset of compressed data within the input buffer. + Length of compressed data within the input buffer. + + Output buffer where decompressed data will be written. + Buffer length minus outOffset must be equal or higher than return value of GetUncompressedLength method. + + Offset into the output buffer where decompressed data will be stored. + Length of decompressed data written into the output buffer. + + + + Decompresses data previously compressed with Snappy. + + Input buffer containing compressed data. + Decompressed data. + + + + Estimates maximum length of compressed data. + Note that compressed data may be slightly larger than uncompressed data in some extreme cases of uncompressible data. + + Length of uncompressed data used as a basis for calculation of maximum length of compressed data. + Maximum length of compressed data given input of length inLength. + + + + Retrieves length of uncompressed data for given buffer of compressed data. This is O(1) lookup + that merely parses first few bytes of the compressed buffer where the length has been recorded during compression. + + Input buffer containing compressed data. + Offset where compressed data is located in the input buffer. + Length of compressed data in the input buffer. + Exact length of uncompressed data encoded in the input buffer. + + + + Retrieves length of uncompressed data for given buffer of compressed data. This is O(1) lookup + that merely parses first few bytes of the compressed buffer where the length has been recorded during compression. + + Input buffer containing compressed data. + Exact length of uncompressed data encoded in the input buffer. + + + + Checks integrity of compressed data. This method performs sanity checks that ensure that the buffer can be decompressed. + It doesn't check integrity of data. It merely ensures that decompression will succeed with _some_ result. + CRC or other data integrity checks can be provided by higher level protocols like the Snappy framing format. + + Input buffer containing compressed data. + Offset where compressed data is located in the input buffer. + Length of compressed data in the input buffer. + True if the buffer contains valid Snappy compressed block. False otherwise. + + + + Checks integrity of compressed data. This method performs sanity checks that ensure that the buffer can be decompressed. + It doesn't check integrity of data. It merely ensures that decompression will succeed with _some_ result. + CRC or other data integrity checks can be provided by higher level protocols like the Snappy framing format. + + Input buffer containing compressed data. + True if the buffer contains valid Snappy compressed block. False otherwise. + + + + Represents single Snappy frame that conforms to Snappy framing format. + + + + + Maximum size of uncompressed data in Snappy frame. It's 64KB in current version of the format. + + + + + Stream identifier text. It is found in ASCII in identifier frame that leads the stream of Snappy frames. + + + + + Create new Snappy frame. Frame is initialized to zero-length padding frame by default. + + + + + Resets this frame to stream identifier frame. First frame in the stream must be identifier frame. + + + + + Resets this frame to padding frame of specified size. + + Size of padding data excluding the 4 bytes of frame header. Maximum padding size is 16MB. + + + + Resets this frame to contain compressed data. + + Uncompressed data that is compressed by this method before being stored in the frame. Maximum data size is 64KB. + + + + Resets this frame to contain compressed data. + + Input buffer containing uncompressed data that is compressed by this method before being stored in the frame. + Offset of uncompressed data in the input buffer. + Size of uncompressed data in the input buffer. Maximum data size is 64KB. + + + + Resets this frame to contain uncompressed data. + + Uncompressed data to store in the frame. Maximum data size is 64KB. + + + + Resets this frame to contain uncompressed data. + + Input buffer containing uncompressed data to be stored in this frame. + Offset of uncompressed data in the input buffer. + Size of uncompressed data in the input buffer. Maximum data size is 64KB. + + + + Retrieves data from the frame. Data is uncompressed before being stored in the output buffer. + CRC of the data is checked and CRC failure results in exception. + + Output buffer where uncompressed data is stored. It must be at least DataLength bytes long. + + + + Retrieves data from the frame. Data is uncompressed before being stored in the output buffer. + CRC of the data is checked and CRC failure results in exception. + + Output buffer where uncompressed data is stored. Buffer length minus offset must be at least DataLength bytes. + Offset into the output buffer where uncompressed data will be stored. + + + + Retrieves Snappy frame from underlying stream. Retrieved frame data is stored in properties of this object. + Return value indicates end of stream. Exceptions indicate data integrity errors and underlying stream errors. + + Underlying stream that will be read by this method. + + True if frame was successfully retrieved. False if there are no more frames in the stream, i.e. the end of stream has been reached. + Note that reaching the end of stream in the middle of the frame is considered an error and causes exception instead. + + + + + Retrieves Snappy frame from underlying stream. Retrieved frame data is stored in properties of this object. + Return value indicates end of stream. Exceptions indicate data integrity errors and underlying stream errors. + + Underlying stream that will be read by this method. + + True if frame was successfully retrieved. False if there are no more frames in the stream, i.e. the end of stream has been reached. + Note that reaching the end of stream in the middle of the frame is considered an error and causes exception instead. + + + + + Retrieves Snappy frame from underlying stream. Retrieved frame data is stored in properties of this object. + Return value indicates end of stream. Exceptions indicate data integrity errors and underlying stream errors. + + Underlying stream that will be read by this method. + Cancellation token that can be used to cancel the read operation. + + True if frame was successfully retrieved. False if there are no more frames in the stream, i.e. the end of stream has been reached. + Note that reaching the end of stream in the middle of the frame is considered an error and causes exception instead. + + + + + Writes the frame into the underlying stream. + + Underlying stream where the frame will be written. + + + + Writes the frame into the underlying stream. + + Underlying stream where the frame will be written. + Task object indicating completion of the write. + + + + Writes the frame into the underlying stream. + + Underlying stream where the frame will be written. + Cancellation token that can be used to cancel the write operation. + Task object indicating completion of the write. + + + + Type of Snappy frame. It contains decoded frame type upon deserialization. It is set automatically by Set* methods. + + + + + Data checksum is present in compressed and uncompressed frames. Otherwise it is zero. + It is computed automatically by Set* methods. + It is automatically checked when reading data through Data property or GetData method. + It is CRC-32C (Castagnoli) of the uncompressed data with final CRC obfuscated + with transformation ((crc >> 15) | (crc << 17)) + 0xa282ead8. + + + + + Length of uncompressed data for data frames. Querying this property takes O(1) time. + For compressed and uncompressed data, data length is never larger than 64KB. + For padding frames, this property is equal to the length of padding data. + Identification frame has data length of 6. + Data length is automatically set by Set* methods and upon frame deserialization. + + + + + Uncompressed data in the frame. It is available only for frame type Compressed or Uncompressed. + Querying this property triggers CRC check of the data, which might cause exceptions. + Returned data is never larger than 64KB. + + + + + Type of Snappy frame. + + + + + Supported compressed frame containing Snappy compressed data. + + + + + Supported uncompressed frame containing plain data. + + + + + Beginning of the range of unsupported frame types reserved for future use. Exception is thrown if any such frame type is encountered. + + + + + End of the range of unsupported frame types reserved for future use. Exception is thrown if any such frame type is encountered. + + + + + Beginning of the range of unsupported frame types that are safe to skip. If encountered on input, data in these frames is skipped. + + + + + End of the range of unsupported frame types that are safe to skip. If encountered on input, data in these frames is skipped. + + + + + Padding frame. Data in this frame is ignored. Padding frames can be used for alignment purposes. + + + + + Stream identifier frame. This frame contains text "sNaPpY". + + + + + Compression stream similar to GZipStream except this one uses Snappy compression. + This stream uses standard Snappy framing format that supports streams of unbounded size + and includes CRC checksums of all transmitted data. + This stream can operate in one of two modes: compression or decompression. + When compressing, use Write* methods. When decompressing, use Read* methods. + If SnappyStream is opened for compression and immediately closed, the resulting stream + will be a valid Snappy stream containing zero bytes of uncompressed data. + + + + + Creates new SnappyStream using specified mode of operation. + + Underlying stream holding compressed data. It is automatically closed when SnappyStream is closed. + + Use mode Compress if SnappyStream is used to compress data and write it to the underlying stream. + Use mode Decompress if SnappyStream is used to decompress data that is retrieved in compressed form from the underlying stream. + + + + + Creates new SnappyStream using specified mode of operation with an option to leave the underlying stream open. + + Underlying stream holding compressed data. + + Use mode Compress if SnappyStream is used to compress data and write it to the underlying stream. + Use mode Decompress if SnappyStream is used to decompress data that is retrieved in compressed form from the underlying stream. + + False to close the underlying stream when SnappyStream is closed. True to leave the underlying stream open. + + + + Dispose the stream. Remaining data is flushed and underlying stream is closed. + + True to release both managed and unmanaged resources. False to release only unmanaged resources. + + + + Reads uncompressed data from underlying compressed stream. + + Output buffer where uncompressed data will be written. + Offset into the output buffer where uncompressed data will be written. + Maximum size of uncompressed data to read. + + Amount of data actually stored in the output buffer. + This might be less than the count parameter if end of stream is encountered. + Return value is zero if there is no more data in the stream. + + + + + Reads uncompressed data from underlying compressed stream. + + Output buffer where uncompressed data will be written. + Offset into the output buffer where uncompressed data will be written. + Maximum size of uncompressed data to read. + Cancellation token that can be used to cancel the read operation. + + Amount of data actually stored in the output buffer. + This might be less than the count parameter if end of stream is encountered. + Return value is zero if there is no more data in the stream. + + + + + Reads single byte from the underlying stream. + + Byte read from the stream or -1 if end of stream has been reached. + + + + Compresses given uncompressed data and writes the compressed data to the underlying stream. + This method will buffer some of the data in order to compress 64KB at a time. + Use Flush method to write the data to the underlying stream immediately. + + Input buffer containing uncompressed data to be compressed and written to the underlying stream. + Offset into the input buffer where uncompressed data is located. + Length of the uncompressed data in the input buffer. Zero-length data has no effect on the stream. + + + + Compresses given uncompressed data and writes the compressed data to the underlying stream. + This method will buffer some of the data in order to compress 64KB at a time. + Use FlushAsync method to write the data to the underlying stream immediately. + + Input buffer containing uncompressed data to be compressed and written to the underlying stream. + Offset into the input buffer where uncompressed data is located. + Length of the uncompressed data in the input buffer. Zero-length data has no effect on the stream. + Cancellation token that can be used to cancel the write operation. + Task object indicating completion of the write. + + + + Writes single byte of uncompressed data to the stream and queues it for compression. + This method will buffer data in order to compress 64KB at a time. + Use Flush method to write the data to the underlying stream immediately. + + Byte of uncompressed data to be added to the stream. + + + + Flushes all data buffered by previous calls to Write* methods. + Remaining data is compressed and written to the underlying stream. + + + + + Flushes all data buffered by previous calls to Write* methods. + Remaining data is compressed and written to the underlying stream. + + Cancellation token that can be used to cancel the flush operation. + Task object indicating completion of the flush. + + + + Sets the length of the current stream. Not supported in SnappyStream. + + The desired length of the current stream in bytes. + + + + Sets the position within the current stream. Not supported in SnappyStream. + + A byte offset relative to the origin parameter. + A value of type SeekOrigin indicating the reference point used to obtain the new position. + + + + + Gets a value indicating whether the current stream supports reading. True for decompression stream. + + + + + Gets a value indicating whether the current stream supports writing. True for compression stream. + + + + + Gets a value indicating whether the current stream supports seeking. Always false for SnappyStream. + + + + + Gets the length in bytes of the stream. Not supported in SnappyStream. + + + + + Gets or sets the position within the current stream. Not supported in SnappyStream. + + + + diff --git a/src/Kafka/packages/ZooKeeperNet.3.3.4.8/ZooKeeperNet.3.3.4.8.nupkg b/src/Kafka/packages/ZooKeeperNet.3.3.4.8/ZooKeeperNet.3.3.4.8.nupkg new file mode 100644 index 0000000..32d22ef Binary files /dev/null and b/src/Kafka/packages/ZooKeeperNet.3.3.4.8/ZooKeeperNet.3.3.4.8.nupkg differ diff --git a/src/Kafka/packages/ZooKeeperNet.3.3.4.8/lib/net40/ZooKeeperNet.dll b/src/Kafka/packages/ZooKeeperNet.3.3.4.8/lib/net40/ZooKeeperNet.dll new file mode 100644 index 0000000..d5a71fb Binary files /dev/null and b/src/Kafka/packages/ZooKeeperNet.3.3.4.8/lib/net40/ZooKeeperNet.dll differ