Compartir a través de


LogWriter Class

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Instance based class to write log messages based on a given configuration. Messages are routed based on category.

Namespace:  Microsoft.Practices.EnterpriseLibrary.Logging
Assembly:  Microsoft.Practices.EnterpriseLibrary.Logging (in Microsoft.Practices.EnterpriseLibrary.Logging.dll)

Syntax

'Declaration
<CustomFactoryAttribute(GetType(LogWriterCustomFactory))> _
PublicClassLogWriter _
    Implements ILogFilterErrorHandler, IInstrumentationEventProvider, IDisposable
[CustomFactoryAttribute(typeof(LogWriterCustomFactory))]
publicclassLogWriter : ILogFilterErrorHandler, IInstrumentationEventProvider, 
    IDisposable
[CustomFactoryAttribute(typeof(LogWriterCustomFactory))]
publicref classLogWriter : ILogFilterErrorHandler, 
    IInstrumentationEventProvider, IDisposable
publicclass LogWriter implements ILogFilterErrorHandler, IInstrumentationEventProvider, IDisposable

Remarks

To write log messages to the default configuration, use the Logger facade. Only create an instance of a LogWriter if you need to write log messages using a custom configuration.

The LogWriter works as an entry point to the System.Diagnostics trace listeners. It will trace the LogEntry through the Microsoft.Practices.EnterpriseLibrary.Logging.TraceListenerss associated with the LogSources for all the matching categories in the elements of the Categories property of the log entry. If the "all events" special log source is configured, the log entry will be traced through the log source regardles of other categories that might have matched. If the "all events" special log source is not configured and the "unprocessed categories" special log source is configured, and the category specified in the logEntry being logged is not defined, then the logEntry will be logged to the "unprocessed categories" special log source. If both the "all events" and "unprocessed categories" special log sources are not configured and the property LogWarningsWhenNoCategoriesMatch is set to true, then the logEntry is logged to the "logging errors and warnings" special log source.

Inheritance Hierarchy

System.Object
  Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter

See Also

LogWriter Members

Microsoft.Practices.EnterpriseLibrary.Logging Namespace

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.