Поделиться через


Creating a Custom Log Provider

The Integration Services run-time environment has extensive logging capabilities. A log lets you capture events that occur during package execution. Integration Services includes a variety of log providers that enable logs to be created and stored in multiple formats, such as XML, text, database, or in the Windows event log. If one of these providers or output formats does not fit your needs, you can create a custom log provider.

The steps involved in creating a custom log provider are similar to the steps for creating any other custom object for Integration Services:

  • Create a new class that inherits from the base class. For a log provider, the base class is LogProviderBase.
  • Apply the attribute that identifies the type of object to the class. For a log provider, the attribute is DtsLogProviderAttribute.
  • Override the implementation of the base class's methods and properties. For a log provider, these include the ConfigString property and the OpenLog, Log, and CloseLog) methods.
  • Custom user interfaces for custom log providers are not implemented in SQL Server 2005 Integration Services (SSIS).

For working samples of custom log providers, see Образец HtmlLogProvider and Образец EmailLogProvider.

Getting Started with a Custom Log Provider

Creating Projects and Classes

Because all managed log providers derive from the LogProviderBase base class, the first step when you create a custom log provider is to create a class library project in your preferred managed programming language, and then create a class that inherits from the base class. In this derived class you will override the methods and properties of the base class to implement your custom functionality.

Configure the project to sign the assembly that will be generated with a strong name key file.

ms136010.note(ru-ru,SQL.90).gifПримечание.
Many Integration Services log providers have a custom user interface that implements IDtsLogProviderUI and replaces the Configuration text box in the Configure SSIS Logs dialog box with a filtered dropdown list of available connection managers. However custom user interfaces for custom log providers are not implemented in SQL Server 2005 Integration Services (SSIS).

Applying the DtsLogProvider Attribute

Apply the DtsLogProviderAttribute attribute to the class that you have created to identify it as a log provider. This attribute provides design-time information such as the name and description of the log provider. The DisplayName and Description properties of the attribute correspond to the Name and Description columns displayed in the Configure SSIS Logs editor, which is displayed when configuring logging for a package in Business Intelligence Development Studio.

ms136010.note(ru-ru,SQL.90).gifВажно!
The LogProviderType property of the attribute is not used. However, you must enter a value for it, or the custom log provider will not appear in the list of available log providers.
ms136010.note(ru-ru,SQL.90).gifПримечание.
Since custom user interfaces for custom log providers are not implemented in SQL Server 2005 Integration Services (SSIS), specifying a value for the UITypeName property of the DtsLogProviderAttribute has no effect.
<DtsLogProvider(DisplayName:="MyLogProvider", Description:="A simple log provider.", LogProviderType:="Custom")> _
Public Class MyLogProvider
     Inherits LogProviderBase
    ' TODO: Override the base class methods.
End Class
[DtsLogProvider(DisplayName="MyLogProvider", Description="A simple log provider.", LogProviderType="Custom")]
public class MyLogProvider : LogProviderBase
{
    // TODO: Override the base class methods.
}

Building, Deploying, and Debugging a Custom Log Provider

The steps for building, deploying, and debugging a custom log provider in Integration Services are very similar to the steps required for other types of custom objects. For more information, see Building, Deploying, and Debugging Custom Objects.

См. также

Задачи

Coding a Custom Log Provider

Основные понятия

Developing a User Interface for a Custom Log Provider

Справка и поддержка

Получение помощи по SQL Server 2005