Common.Logging Indicates classes or members to be ignored by NCover Note, the key is chosen, because TestDriven.NET uses it as //ea argument to "Test With... Coverage" Erich Eichinger The exception that is thrown when a configuration system error has occurred with Common.Logging Mark Pollack Creates a new instance of the ObjectsException class. Creates a new instance of the ConfigurationException class. with the specified message. A message about the exception. Creates a new instance of the ConfigurationException class with the specified message and root cause. A message about the exception. The root exception that is being wrapped. Creates a new instance of the ConfigurationException class. The that holds the serialized object data about the exception being thrown. The that contains contextual information about the source or destination. Various utility methods for using during factory and logger instance configuration Erich Eichinger Initialize all members before any of this class' methods can be accessed (avoids beforeFieldInit) Adds the parser to the list of known type parsers. .NET intrinsic types are pre-registerd: short, int, long, float, double, decimal, bool Retrieves the named value from the specified . may be null the value's key if is not null, the value returned by values[key]. null otherwise. Retrieves the named value from the specified . may be null the value's key the default value, if not found if is not null, the value returned by values[key]. null otherwise. Returns the first nonnull, nonempty value among its arguments. Returns null, if the initial list was null or empty. Returns the first nonnull, nonempty value among its arguments. Also Tries parsing into an enum of the type of . the default value to return if parsing fails the string value to parse the successfully parsed value, otherwise. Tries parsing into the specified return type. the default value to return if parsing fails the string value to parse the successfully parsed value, otherwise. Throws a if is null. Throws a if is null. Throws a if an object of type is not assignable to type . Throws a if an object of type is not assignable to type . Ensures any exception thrown by the given is wrapped with an . If already throws a ConfigurationException, it will not be wrapped. the action to execute the message to be set on the thrown args to be passed to to format the message Ensures any exception thrown by the given is wrapped with an . If already throws a ConfigurationException, it will not be wrapped. the action to execute the message to be set on the thrown args to be passed to to format the message A delegate converting a string representation into the target type An anonymous action delegate with no arguments and no return value. An anonymous action delegate with no arguments and no return value. Implementation of that uses the standard .NET configuration APIs, ConfigurationSettings in 1.x and ConfigurationManager in 2.0 Mark Pollack Parses the configuration section and returns the resulting object. Using the System.Configuration.ConfigurationManager Name of the configuration section. Object created by a corresponding IConfigurationSectionHandler"

Primary purpose of this method is to allow us to parse and load configuration sections using the same API regardless of the .NET framework version.

Container used to hold configuration information from config file. Gilles Bayon The type that will be used for creating Additional user supplied properties that are passed to the 's constructor. The type that will be used for creating instances. Additional user supplied properties that are passed to the 's constructor. Substitute NameValueCollection in System.Collections.Specialized. Creates a new instance of NameValueCollection. Gets the values (only a single one) for the specified key (configuration name) The key. an array with one value, or null if no value exist Gets or sets the value with the specified key. The value corrsponding to the key, or null if no value exist The key. value store for the key Helper class for working with NameValueCollection Convert a into the corresponding common logging equivalent The properties. An implementation of that caches loggers handed out by this factory. Implementors just need to override . Erich Eichinger Creates a new instance, the logger cache being case-sensitive. Creates a new instance, the logger cache being . Purges all loggers from cache Create the specified named logger instance Derived factories need to implement this method to create the actual logger instance. Get a ILog instance by . Usually the of the current class. An ILog instance either obtained from the internal cache or created by a call to . Get a ILog instance by key. Usually a 's Name or FullName property. An ILog instance either obtained from the internal cache or created by a call to . Get or create a ILog instance by key. Usually a 's Name or FullName property. An ILog instance either obtained from the internal cache or created by a call to . Provides base implementation suitable for almost all logger adapters Erich Eichinger Holds the method for writing a message to the log system. Creates a new logger instance using for writing log events to the underlying log system. Override this method to use a different method than for writing log events to the underlying log system. Usually you don't need to override thise method. The default implementation returns null to indicate that the default handler should be used. Actually sends the message to the underlying log system. the level of this log event. the message to log the exception to log (may be null) Log a message object with the level. The message object to log. Log a message object with the level including the stack trace of the passed as a parameter. The message object to log. The exception to log, including its stack trace. Log a message with the level. An that supplies culture-specific formatting information. The format of the message object to log. Log a message with the level. An that supplies culture-specific formatting information. The format of the message object to log. The exception to log. Log a message with the level. The format of the message object to log. the list of format arguments Log a message with the level. The format of the message object to log. The exception to log. the list of format arguments Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. A callback used by the logger to obtain the message if log level is matched Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack trace. Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack trace. Log a message object with the level. The message object to log. Log a message object with the level including the stack Debug of the passed as a parameter. The message object to log. The exception to log, including its stack Debug. Log a message with the level. An that supplies culture-specific formatting information. The format of the message object to log. Log a message with the level. An that supplies culture-specific formatting information. The format of the message object to log. The exception to log. Log a message with the level. The format of the message object to log. the list of format arguments Log a message with the level. The format of the message object to log. The exception to log. the list of format arguments Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. A callback used by the logger to obtain the message if log level is matched Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Debug. Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Debug. Log a message object with the level. The message object to log. Log a message object with the level including the stack Info of the passed as a parameter. The message object to log. The exception to log, including its stack Info. Log a message with the level. An that supplies culture-specific formatting information. The format of the message object to log. Log a message with the level. An that supplies culture-specific formatting information. The format of the message object to log. The exception to log. Log a message with the level. The format of the message object to log. the list of format arguments Log a message with the level. The format of the message object to log. The exception to log. the list of format arguments Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. A callback used by the logger to obtain the message if log level is matched Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Info. Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Info. Log a message object with the level. The message object to log. Log a message object with the level including the stack Warn of the passed as a parameter. The message object to log. The exception to log, including its stack Warn. Log a message with the level. An that supplies culture-specific formatting Information. The format of the message object to log. Log a message with the level. An that supplies culture-specific formatting information. The format of the message object to log. The exception to log. Log a message with the level. The format of the message object to log. the list of format arguments Log a message with the level. The format of the message object to log. The exception to log. the list of format arguments Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. A callback used by the logger to obtain the message if log level is matched Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Warn. Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Warn. Log a message object with the level. The message object to log. Log a message object with the level including the stack Error of the passed as a parameter. The message object to log. The exception to log, including its stack Error. Log a message with the level. An that supplies culture-specific formatting Errorrmation. The format of the message object to log. Log a message with the level. An that supplies culture-specific formatting Errorrmation. The format of the message object to log. The exception to log. Log a message with the level. The format of the message object to log. the list of format arguments Log a message with the level. The format of the message object to log. The exception to log. the list of format arguments Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. A callback used by the logger to obtain the message if log level is matched Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Error. Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Error. Log a message object with the level. The message object to log. Log a message object with the level including the stack Fatal of the passed as a parameter. The message object to log. The exception to log, including its stack Fatal. Log a message with the level. An that supplies culture-specific formatting Fatalrmation. The format of the message object to log. Log a message with the level. An that supplies culture-specific formatting Fatalrmation. The format of the message object to log. The exception to log. Log a message with the level. The format of the message object to log. the list of format arguments Log a message with the level. The format of the message object to log. The exception to log. the list of format arguments Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. A callback used by the logger to obtain the message if log level is matched Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Fatal. Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched Log a message with the level using a callback to obtain the message Using this method avoids the cost of creating a message and evaluating message arguments that probably won't be logged due to loglevel settings. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Fatal. Checks if this logger is enabled for the level. Override this in your derived class to comply with the underlying logging system Checks if this logger is enabled for the level. Override this in your derived class to comply with the underlying logging system Checks if this logger is enabled for the level. Override this in your derived class to comply with the underlying logging system Checks if this logger is enabled for the level. Override this in your derived class to comply with the underlying logging system Checks if this logger is enabled for the level. Override this in your derived class to comply with the underlying logging system Checks if this logger is enabled for the level. Override this in your derived class to comply with the underlying logging system Returns the global context for variables Returns the thread-specific context for variables Format message on demand. Initializes a new instance of the class. The format message callback. Initializes a new instance of the class. The format provider. The format message callback. Calls and returns result. Format string on demand. Initializes a new instance of the class. The format provider. The message. The args. Runs on supplied arguemnts. string Represents a method responsible for writing a message to the log system. Use the LogManager's or methods to obtain instances for logging. For configuring the underlying log system using application configuration, see the example at System.Configuration.ConfigurationManager For configuring programmatically, see the example section below. The example below shows the typical use of LogManager to obtain a reference to a logger and log an exception: ILog log = LogManager.GetLogger(this.GetType()); ... try { /* .... */ } catch(Exception ex) { log.ErrorFormat("Hi {0}", ex, "dude"); } The example below shows programmatic configuration of the underlying log system: // create properties NameValueCollection properties = new NameValueCollection(); properties["showDateTime"] = "true"; // set Adapter Common.Logging.LogManager.Adapter = new Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter(properties); Gilles Bayon Performs static 1-time init of LogManager by calling Reset the infrastructure to its default settings. This means, that configuration settings will be re-read from section <common/logging> of your app.config. This is mainly used for unit testing, you wouldn't normally use this in your applications.
Note: instances already handed out from this LogManager are not(!) affected. Resetting LogManager only affects new instances being handed out.
Reset the infrastructure to its default settings. This means, that configuration settings will be re-read from section <common/logging> of your app.config. This is mainly used for unit testing, you wouldn't normally use this in your applications.
Note: instances already handed out from this LogManager are not(!) affected. Resetting LogManager only affects new instances being handed out.
the instance to obtain settings for re-initializing the LogManager.
Gets the logger by calling on the currently configured using the type of the calling class. This method needs to inspect the in order to determine the calling class. This of course comes with a performance penalty, thus you shouldn't call it too often in your application. the logger instance obtained from the current Gets the logger by calling on the currently configured using the type of the calling class. This method needs to inspect the in order to determine the calling class. This of course comes with a performance penalty, thus you shouldn't call it too often in your application. the logger instance obtained from the current Gets the logger by calling on the currently configured using the specified type. the logger instance obtained from the current Gets the logger by calling on the currently configured using the specified type. the logger instance obtained from the current Gets the logger by calling on the currently configured using the specified type. The type. the logger instance obtained from the current Gets the logger by calling on the currently configured using the specified type. The type. the logger instance obtained from the current Gets the logger by calling on the currently configured using the specified key. The key. the logger instance obtained from the current Gets the logger by calling on the currently configured using the specified key. The key. the logger instance obtained from the current Builds the logger factory adapter. a factory adapter instance. Is never null. Builds a instance from the given using . the instance. Is never null The key of the default configuration section to read settings from. You can always change the source of your configuration settings by setting another instance on . The key of the default configuration section to read settings from. You can always change the source of your configuration settings by setting another instance on . Gets the configuration reader used to initialize the LogManager. Primarily used for testing purposes but maybe useful to obtain configuration information from some place other than the .NET application configuration file. The configuration reader. Gets the configuration reader used to initialize the LogManager. Primarily used for testing purposes but maybe useful to obtain configuration information from some place other than the .NET application configuration file. The configuration reader. Gets or sets the adapter. The adapter. Gets or sets the adapter. The adapter. Abstract class providing a standard implementation of simple loggers. Erich Eichinger Creates and initializes a the simple logger. The key, usually type key of the calling class, of the logger. The current logging threshold. Messages recieved that are beneath this threshold will not be logged. Include level in the log message. Include the current time in the log message. Include the instance key in the log message. The date and time format to use in the log message. Appends the formatted message to the specified . the that receíves the formatted message. Determines if the given log level is currently enabled. The key of the logger. Include the current log level in the log message. Include the current time in the log message. Include the instance key in the log message. The current logging threshold. Messages recieved that are beneath this threshold will not be logged. The date and time format to use in the log message. Determines Whether is set. Returns if the current is greater than or equal to . If it is, all messages will be sent to . Returns if the current is greater than or equal to . If it is, all messages will be sent to . Returns if the current is greater than or equal to . If it is, only messages with a of , , , and will be sent to . Returns if the current is greater than or equal to . If it is, only messages with a of , , and will be sent to . Returns if the current is greater than or equal to . If it is, only messages with a of and will be sent to . Returns if the current is greater than or equal to . If it is, only messages with a of will be sent to . Base factory implementation for creating simple instances. Default settings are LogLevel.All, showDateTime = true, showLogName = true, and no DateTimeFormat. The keys in the NameValueCollection to configure this adapter are the following level showDateTime showLogName dateTimeFormat Here is an example how to implement your own logging adapter: public class ConsoleOutLogger : AbstractSimpleLogger { public ConsoleOutLogger(string logName, LogLevel logLevel, bool showLevel, bool showDateTime, bool showLogName, string dateTimeFormat) : base(logName, logLevel, showLevel, showDateTime, showLogName, dateTimeFormat) { } protected override void WriteInternal(LogLevel level, object message, Exception e) { // Use a StringBuilder for better performance StringBuilder sb = new StringBuilder(); FormatOutput(sb, level, message, e); // Print to the appropriate destination Console.Out.WriteLine(sb.ToString()); } } public class ConsoleOutLoggerFactoryAdapter : AbstractSimpleLoggerFactoryAdapter { public ConsoleOutLoggerFactoryAdapter(NameValueCollection properties) : base(properties) { } protected override ILog CreateLogger(string key, LogLevel level, bool showLevel, bool showDateTime, bool showLogName, string dateTimeFormat) { ILog log = new ConsoleOutLogger(key, level, showLevel, showDateTime, showLogName, dateTimeFormat); return log; } } Gilles Bayon Mark Pollack Erich Eichinger Initializes a new instance of the class. Looks for level, showDateTime, showLogName, dateTimeFormat items from for use when the GetLogger methods are called. System.Configuration.ConfigurationManager for more information on how to use the standard .NET application configuraiton file (App.config/Web.config) to configure this adapter. The key value collection, typically specified by the user in a configuration section named common/logging. Initializes a new instance of the class with default settings for the loggers created by this factory. Create the specified logger instance Derived factories need to implement this method to create the actual logger instance. a new logger instance. Must never be null! The default to use when creating new instances. The default setting to use when creating new instances. The default setting to use when creating new instances. The default setting to use when creating new instances. The default setting to use when creating new instances. A logger created by that sends all log events to the owning adapter's Erich Eichinger The adapter that created this logger instance. Clears all captured events Resets the to null. Holds the list of logged events. To access this collection in a multithreaded application, put a lock on the list instance. instances send their captured log events to this method. Create a new logger instance. Create a new and send it to Holds the last log event received from any of this adapter's loggers. A logging event captured by Erich Eichinger The logger that logged this event The level used to log this event The raw message object A logged exception Create a new event instance Retrieves the formatted message text An adapter, who's loggers capture all log events and send them to . Retrieve the list of log events from . This logger factory is mainly for debugging and test purposes. This is an example how you might use this adapter for testing: // configure for capturing CapturingLoggerFactoryAdapter adapter = new CapturingLoggerFactoryAdapter(); LogManager.Adapter = adapter; // reset capture state adapter.Clear(); // log something ILog log = LogManager.GetCurrentClassLogger(); log.DebugFormat("Current Time:{0}", DateTime.Now); // check logged data Assert.AreEqual(1, adapter.LoggerEvents.Count); Assert.AreEqual(LogLevel.Debug, adapter.LastEvent.Level); Erich Eichinger Clears all captured events Resets the to null. Holds the list of logged events. To access this collection in a multithreaded application, put a lock on the list instance. instances send their captured log events to this method. Get a instance for the given type. Get a instance for the given key. Holds the last log event received from any of this adapter's loggers. Sends log messages to . Gilles Bayon Creates and initializes a logger that writes messages to . The key, usually type key of the calling class, of the logger. The current logging threshold. Messages recieved that are beneath this threshold will not be logged. Include the current log level in the log message. Include the current time in the log message. Include the instance key in the log message. The date and time format to use in the log message. Do the actual logging by constructing the log message using a then sending the output to . The of the message. The log message. An optional associated with the message. Factory for creating instances that write data using . Below is an example how to configure this adapter: <configuration> <configSections> <sectionGroup key="common"> <section key="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" requirePermission="false" /> </sectionGroup> </configSections> <common> <logging> <factoryAdapter type="Common.Logging.Simple.DebugLoggerFactoryAdapter, Common.Logging"> <arg key="level" value="ALL" /> </factoryAdapter> </logging> </common> </configuration> Gilles Bayon Mark Pollack Erich Eichinger Initializes a new instance of the class using default settings. Initializes a new instance of the class. Looks for level, showDateTime, showLogName, dateTimeFormat items from for use when the GetLogger methods are called. for more information on how to use the standard .NET application configuraiton file (App.config/Web.config) to configure this adapter. The key value collection, typically specified by the user in a configuration section named common/logging. Initializes a new instance of the class with default settings for the loggers created by this factory. Creates a new instance. Silently ignores all log messages. Gilles Bayon Erich Eichinger Ignores message. Ignores message. Ignores message. The format of the message object to log. Ignores message. The format of the message object to log. The exception to log. the list of message format arguments Ignores message. An that supplies culture-specific formatting information. The format of the message object to log. the list of message format arguments Ignores message. An that supplies culture-specific formatting information. The format of the message object to log. The exception to log. the list of message format arguments Ignores message. A callback used by the logger to obtain the message if log level is matched Ignores message. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack trace. Ignores message. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched Ignores message. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack trace. Ignores message. Ignores message. Ignores message. The format of the message object to log. Ignores message. The format of the message object to log. The exception to log. the list of message format arguments Ignores message. An that supplies culture-specific formatting information. The format of the message object to log. the list of message format arguments Ignores message. An that supplies culture-specific formatting information. The format of the message object to log. The exception to log. the list of message format arguments Ignores message. A callback used by the logger to obtain the message if log level is matched Ignores message. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Debug. Ignores message. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched Ignores message. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Debug. Ignores message. Ignores message. Ignores message. The format of the message object to log. Ignores message. The format of the message object to log. The exception to log. the list of message format arguments Ignores message. An that supplies culture-specific formatting information. The format of the message object to log. the list of message format arguments Ignores message. An that supplies culture-specific formatting information. The format of the message object to log. The exception to log. the list of message format arguments Ignores message. A callback used by the logger to obtain the message if log level is matched Ignores message. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Info. Ignores message. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched Ignores message. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Info. Ignores message. Ignores message. Ignores message. The format of the message object to log. Ignores message. The format of the message object to log. The exception to log. the list of message format arguments Ignores message. An that supplies culture-specific formatting Information. The format of the message object to log. the list of message format arguments Ignores message. An that supplies culture-specific formatting Information. The format of the message object to log. The exception to log. the list of message format arguments Ignores message. A callback used by the logger to obtain the message if log level is matched Ignores message. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Warn. Ignores message. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched Ignores message. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Warn. Ignores message. Ignores message. Ignores message. The format of the message object to log. Ignores message. The format of the message object to log. The exception to log. the list of message format arguments Ignores message. An that supplies culture-specific formatting Errorrmation. The format of the message object to log. the list of message format arguments Ignores message. An that supplies culture-specific formatting Errorrmation. The format of the message object to log. The exception to log. the list of message format arguments Ignores message. A callback used by the logger to obtain the message if log level is matched Ignores message. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Error. Ignores message. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched Ignores message. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Error. Ignores message. Ignores message. Ignores message. The format of the message object to log. Ignores message. The format of the message object to log. The exception to log. the list of message format arguments Ignores message. An that supplies culture-specific formatting Fatalrmation. The format of the message object to log. the list of message format arguments Ignores message. An that supplies culture-specific formatting Fatalrmation. The format of the message object to log. The exception to log. the list of message format arguments Ignores message. A callback used by the logger to obtain the message if log level is matched Ignores message. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Fatal. Ignores message. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched Ignores message. An that supplies culture-specific formatting information. A callback used by the logger to obtain the message if log level is matched The exception to log, including its stack Fatal. Always returns . Always returns . Always returns . Always returns . Always returns . Always returns . Returns the global context for variables Returns the thread-specific context for variables Factory for creating instances that silently ignores logging requests. This logger adapter is the default used by Common.Logging if unconfigured. Using this logger adapter is the most efficient way to suppress any logging output. Below is an example how to configure this adapter: <configuration> <configSections> <sectionGroup key="common"> <section key="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" requirePermission="false" /> </sectionGroup> </configSections> <common> <logging> <factoryAdapter type="Common.Logging.Simple.NoOpLoggerFactoryAdapter, Common.Logging"> <arg key="level" value="ALL" /> </factoryAdapter> </logging> </common> </configuration> Gilles Bayon Constructor Constructor Constructor for binary backwards compatibility The properties. Get a ILog instance by type Get a ILog instance by type key A null-functionality implementation of Sets the value of a new or existing variable within the global context The key of the variable that is to be added The value to add Gets the value of a variable within the global context The key of the variable to get The value or null if not found Checks if a variable is set within the global context The key of the variable to check for True if the variable is set Removes a variable from the global context by key The key of the variable to remove Clears the global context variables A implementation sending all System.Diagnostics.Trace output to the Common.Logging infrastructure. This listener captures all output sent by calls to System.Diagnostics.Trace and and and sends it to an instance.
The instance to be used is obtained by calling . The name of the logger is created by passing this listener's and any source or category passed into this listener (see or for example).
The snippet below shows how to add and configure this listener to your app.config: <system.diagnostics> <sharedListeners> <add name="Diagnostics" type="Common.Logging.Simple.CommonLoggingTraceListener, Common.Logging" initializeData="DefaultTraceEventType=Information; LoggerNameFormat={listenerName}.{sourceName}"> <filter type="System.Diagnostics.EventTypeFilter" initializeData="Information"/> </add> </sharedListeners> <trace> <listeners> <add name="Diagnostics" /> </listeners> </trace> </system.diagnostics> Erich Eichinger
Creates a new instance with the default name "Diagnostics" and "Trace". Creates a new instance initialized with properties from the . string. is a semicolon separated string of name/value pairs, where each pair has the form key=value. E.g. "Name=MyLoggerName;LogLevel=Debug" a semicolon separated list of name/value pairs. Creates a new instance initialized with the specified properties. name/value configuration properties. Logs the given message to the Common.Logging infrastructure. the eventType the name or category name passed into e.g. . the id of this event the message format the message arguments Writes message to logger provided by . Writes message to logger provided by . Writes message to logger provided by . Writes message to logger provided by . Writes message to logger provided by . Writes message to logger provided by . Writes message to logger provided by . Writes message to logger provided by Writes message to logger provided by Writes message to logger provided by Writes message to logger provided by Writes message to logger provided by Writes message to logger provided by Sets the default to use for logging all events emitted by .Write(...) and .WriteLine(...) methods. This listener captures all output sent by calls to and sends it to an instance using the specified on . Format to use for creating the logger name. Defaults to "{listenerName}.{sourceName}". Available placeholders are: {listenerName}: the configured name of this listener instance. {sourceName}: the trace source name an event originates from (see e.g. . Used in an application's configuration file (App.Config or Web.Config) to configure the logging subsystem. An example configuration section that writes log messages to the Console using the built-in Console Logger. <configuration> <configSections> <sectionGroup name="common"> <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" /> </sectionGroup> </configSections> <common> <logging> <factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging"> <arg key="showLogName" value="true" /> <arg key="showDateTime" value="true" /> <arg key="level" value="ALL" /> <arg key="dateTimeFormat" value="yyyy/MM/dd HH:mm:ss:fff" /> </factoryAdapter> </logging> </common> </configuration> Ensure static fields get initialized before any class member can be accessed (avoids beforeFieldInit) Constructor Retrieves the of the logger the use by looking at the logFactoryAdapter element of the logging configuration element. A object containing the specified type that implements along with zero or more properties that will be passed to the logger factory adapter's constructor as an . Verifies that the logFactoryAdapter element appears once in the configuration section. settings of a parent section - atm this must always be null Additional information about the configuration process. The configuration section to apply an XPath query too. A object containing the specified logFactoryAdapter type along with user supplied configuration properties. Verifies that the logFactoryAdapter element appears once in the configuration section. The parent of the current item. Additional information about the configuration process. The configuration section to apply an XPath query too. A object containing the specified logFactoryAdapter type along with user supplied configuration properties. Sends log messages to . Gilles Bayon Creates and initializes a logger that writes messages to . The name, usually type name of the calling class, of the logger. The current logging threshold. Messages recieved that are beneath this threshold will not be logged. Include the current log level in the log message. Include the current time in the log message. Include the instance name in the log message. The date and time format to use in the log message. Creates and initializes a logger that writes messages to . The name, usually type name of the calling class, of the logger. The current logging threshold. Messages recieved that are beneath this threshold will not be logged. Include the current log level in the log message. Include the current time in the log message. Include the instance name in the log message. The date and time format to use in the log message. Use color when writing the log message. Do the actual logging by constructing the log message using a then sending the output to . The of the message. The log message. An optional associated with the message. Factory for creating instances that write data to . Below is an example how to configure this adapter: <configuration> <configSections> <sectionGroup name="common"> <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" requirePermission="false" /> </sectionGroup> </configSections> <common> <logging> <factoryAdapter type="Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter, Common.Logging"> <arg key="level" value="ALL" /> </factoryAdapter> </logging> </common> </configuration> Gilles Bayon Mark Pollack Erich Eichinger Initializes a new instance of the class using default settings. Initializes a new instance of the class. Looks for level, showDateTime, showLogName, dateTimeFormat items from for use when the GetLogger methods are called. for more information on how to use the standard .NET application configuraiton file (App.config/Web.config) to configure this adapter. The name value collection, typically specified by the user in a configuration section named common/logging. Constructor for binary backwards compatibility with non-portableversions The properties. Initializes a new instance of the class with default settings for the loggers created by this factory. Initializes a new instance of the class with default settings for the loggers created by this factory. Creates a new instance. Logger sending everything to the trace output stream using . Beware not to use in combination with this logger as this would result in an endless loop for obvious reasons! Gilles Bayon Erich Eichinger Creates a new TraceLogger instance. whether to use or for logging. the name of this logger the default log level to use Include the current log level in the log message. Include the current time in the log message. Include the instance name in the log message. The date and time format to use in the log message. Determines if the given log level is currently enabled. checks if is true. Do the actual logging. Called after deserialization completed. Used to defer message formatting until it is really needed. This class also improves performance when multiple s are configured. Factory for creating instances that send everything to the output stream. Beware not to use in combination with this logger factory as this would result in an endless loop for obvious reasons! Below is an example how to configure this adapter: <configuration> <configSections> <sectionGroup name="common"> <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" requirePermission="false" /> </sectionGroup> </configSections> <common> <logging> <factoryAdapter type="Common.Logging.Simple.TraceLoggerFactoryAdapter, Common.Logging"> <arg key="level" value="ALL" /> </factoryAdapter> </logging> </common> </configuration> Gilles Bayon Mark Pollack Erich Eichinger Initializes a new instance of the class using default settings. Initializes a new instance of the class. Looks for level, showDateTime, showLogName, dateTimeFormat items from for use when the GetLogger methods are called. for more information on how to use the standard .NET application configuraiton file (App.config/Web.config) to configure this adapter. The name value collection, typically specified by the user in a configuration section named common/logging. Initializes a new instance of the class with default settings for the loggers created by this factory. Creates a new instance. Whether to use .TraceXXXX(string,object[]) methods for logging or .