是否可以从dtsConfig文件配置SSIS日志记录?

时间:2014-04-02 14:35:02

标签: ssis

我想配置执行DTSX软件包时记录的事件(和什么属性),我们拥有大约50个软件包。我们已经使用.dtsConfig文件来配置数据库连接和其他属性的详细信息。当我在配置向导中检查日志提供程序树时,它仅存储用于日志记录的连接。是否可以存储细节?这是包中的配置:

<DTS:LoggingOptions>
<DTS:Property DTS:Name="LoggingMode">1</DTS:Property>
<DTS:Property DTS:Name="FilterKind">0</DTS:Property>
<DTS:Property DTS:Name="EventFilter" DTS:DataType="8">3,7,OnError,13,OnInformation,9,OnWarning</DTS:Property>
<DTS:Property DTS:Name="ColumnFilter" DTS:EventName="OnError">
    <DTS:Property DTS:Name="Computer">0</DTS:Property>
    <DTS:Property DTS:Name="Operator">0</DTS:Property>
    <DTS:Property DTS:Name="SourceName">-1</DTS:Property>
    <DTS:Property DTS:Name="SourceID">-1</DTS:Property>
    <DTS:Property DTS:Name="ExecutionID">-1</DTS:Property>
    <DTS:Property DTS:Name="MessageText">-1</DTS:Property>
    <DTS:Property DTS:Name="DataBytes">-1</DTS:Property>
</DTS:Property>
...

1 个答案:

答案 0 :(得分:1)

* 是不可能的。对于使用软件包部署模型的2012年之前的软件包和2012/2014软件包,日志记录涉及修改软件包本身。

如果您对.NET很方便,可以查看如何通过Replicate tables with SSIS EzAPI上的帖子中的代码打开/关闭日志记录(无需为此下载EzAPI库)

此处的相关代码位

///////////////////////////////////////////////////////////////
// Enable logging
// Add log provider and such
// http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.logproviders.add.aspx
// ProgID: DTS.LogProviderSQLServer.2
///////////////////////////////////////////////////////////////
DTSEventColumnFilter eventFilter = new DTSEventColumnFilter();
eventFilter.Computer = true;
eventFilter.DataBytes = true;
eventFilter.ExecutionID = true;
eventFilter.MessageText = true;
eventFilter.Operator = true;
eventFilter.SourceID = true;
eventFilter.SourceName = true;

p.LoggingMode = DTSLoggingMode.Enabled;

// Define the events we care about
string[] notableEvents = new string[] { "OnError", "OnInformation", "OnPostExecute", "OnPreExecute", "OnWarning", "OnTaskFailed" };

// Add and configure the sql log provider
LogProvider provider = p.LogProviders.Add("DTS.LogProviderSQLServer.2");

provider.ConfigString = loggingCM.Name;
provider.Name = "SSIS log provider for SQL Server";
provider.Description = "Writes log entries for events to a SQL Server database";
p.LoggingOptions.SelectedLogProviders.Add(provider);

LoggingOptions options = p.LoggingOptions;
// load up the events we care about
options.EventFilter = notableEvents;
options.EventFilterKind = DTSEventFilterKind.Inclusion;

// configure the specifics of how an event should be logged
foreach (string item in notableEvents)
{
    options.SetColumnFilter(item, eventFilter);
}

* 取决于您的组织对开源产品的容忍度,dtLoggedExec