The HtmlLogProvider sample demonstrates how to create a custom log provider, the Html Log Provider, which writes logging output to an HTML document.
For more information about how to create a custom log provider, see Creating a Custom Log Provider. For general information about the use of log providers in Integration Services, see Integration Services Log Providers.
The custom log provider obtains the name of a destination file that has the extension .htm or .html from an existing File connection manager. It outputs logged events to an HTML table in the specified destination file, ignoring the final two standard columns (dataCode and dataBytes) which may contain binary data that cannot be displayed correctly in an HTML document. The sample encapsulates the HTML logging code in a separate HtmlLogWriter helper class for ease of reuse. This helper class has OpenLogHtml, LogHtml, and CloseLogHtml subroutines, which are called from OpenLog, Log, and CloseLog respectively. This sample is not supported on Itanium-based operating systems.
This code sample implements the following functionality:
Overriding of the LogProviderBase class.
Default persistence support that does not require the developer to write custom persistence code.
|Samples are provided for educational purposes only. They are not intended to be used in a production environment and have not been tested in a production environment. Microsoft does not provide technical support for these samples.|
If you already know how to locate, build, and install code samples, you can go directly to the section Testing the Sample, and read about how to configure and run the code sample.
If the code sample was installed to the default location, the sample is located in the following directory:
C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\\Programming Samples\Control Flow\HtmlLogProvider Sample
The C# solution for the code sample is located in the CS directory, and the Visual Basic solution is located in the VB directory.
For information about the two-step process required to install the samples, see Installing Samples. To obtain the latest version of the samples, including new samples released after the original release of SQL Server 2005, see SQL Server 2005 Samples and Sample Databases (April 2006).
If you have not already generated a strong name key file in the Samples folder, use the following procedure to generate this key file. The sample projects are configured on the Signing tab of the Project Properties dialog box to sign assemblies at build time with this key file.
To open a Microsoft Visual Studio 2005 command prompt, click Start, point to All Programs, point to Microsoft Visual Studio 2005, point to Visual Studio Tools, and then click Visual Studio 2005 Command Prompt.
- or -
To open a Microsoft .NET Framework command prompt, click Start, point to All Programs, point to Microsoft .NET Framework SDK v2.0, and then click SDK Command Prompt.
At the command prompt, use the change directory (CD) command to change the current folder of the command prompt to the Samples folder. The key file that you create in this folder will be used by all SQL Server 2005 code samples.
Note: To determine the folder where samples are located, click Start, point to All Programs, point to Microsoft SQL Server 2005, point to Documentation and Tutorials, and then click Samples Directory. If the default installation location was used, the samples are located in <system_drive>:\Program Files\Microsoft SQL Server\90\Samples.
At the command prompt, run the following command to generate the key file:
sn -k SampleKey.snk
Important: For more information about the strong-name key pair, see "Security Briefs: Strong Names and Security in the .NET Framework" in the .NET Development Center on MSDN.
This sample is provided in both Visual Basic and C#. To distinguish the assemblies for each version of the sample, the name of the output assembly has CS or VB appended. After successfully building the component, follow these steps in order to add it as a connection manager in a package in Business Intelligence Development Studio.
Open a Command Prompt window.
Type the following commands to install the C# version of the component into the GAC:
gacutil.exe -iF " C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Programming Samples\Control Flow\HtmlLogProvider Sample\CS\HtmlLogProviderCS\bin\Debug\HtmlLogProviderCS.dll"
- or -
Type the following commands to install the Visual Basic version of the component into the GAC:
gacutil.exe -iF " C:\Program Files\Microsoft SQL Server\90\Samples\Integration Services\Programming Samples\Control Flow\HtmlLogProvider Sample\VB\HtmlLogProviderVB\bin\Debug\HtmlLogProviderVB.dll"
You can now test the custom log provider in a package.
In an Integration Services project, add a new File connection manager and configure it to point to a file that has the extension .htm or .html.
From the SSIS menu, select Logging, and add the Custom log provider for HTML files (CS) or Custom log provider for HTML files (VB).
In the Configuration column, enter the name of the File connection manager.
Configure logging as appropriate so that the package and its components log their events to the custom log provider.
Run the package, and then open the HTML file to view the logging output.