Common.Logging Indicates classes or members to be ignored by NCover Note, the name is chosen, because TestDriven.NET uses it as //ea argument to "Test With... Coverage" Erich Eichinger Helper class for working with NameValueCollection Convert a into the corresponding common logging equivalent The properties. 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="showDataTime" 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. 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. 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 .