Programming with LEADTOOLS Logging

Programming with LEADTOOLS Logging

Creating Logging Channels

A Logging Channel is an object that listens for log messages and processes them. The Leadtools.Logging assembly provides several default implementations of logging channels. To create your own logging channel, you must create a class that implements ILoggingChannel. If you don't want to completely re-implement ILoggingChannel, then you can create a new class that derives from the LoggingChannel base class instead.

Logging Messages

Logging messages consists of sending log entries to the registered log channels. If you want log a specific log entry type you can call one of the Logger specific methods:

For more control over the log entry, you can use the Logger.Log method to send a LogEntry item. If you require custom information use the LogEntry.CustomInformation dictionary.

Logging DICOM Messages

If you want to log DICOM specific messages use Leadtools.Logging.Medical.LogExtensions. A MessageDirection type is provided to allow you to specify the direction of a communication message. In addition, the DicomLogEntry class is a custom ILogEntry implementation that has additional properties specific to DICOM logging.

Configuring AppConfig for Logging

To configure logging in your App.Config file you need to first add the configuration section.

After adding the configuration section you can begin by adding the logging section. The logging section has the following child elements.

channels Global channels that are accessed with Logger.Global.
loggers Custom loggers are stored in this element.

The element has the following child element.

channel User specific logging channel. Multiple elements allowed.

The element has the following attributes:

The element has the following child element:

logger User defined logger. Multiple elements allowed.

The element has the following attributes:

The element has the following child element:

channels List of channels associated with the logger.
Help Version 20.0.2018.3.2
Products | Support | Contact Us | Copyright Notices
© 1991-2018 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Imaging, Medical, and Document