[英]how to set the log file path of the SSIS package programmatically
I am executing SSIS package programmatically using C# and I want to set the log file for the package by reading the path from the web.config file.我正在使用 C# 以编程方式执行 SSIS 包,我想通过从 web.config 文件中读取路径来设置包的日志文件。 I looked at the code from the link http://msdn.microsoft.com/en-us/library/ms136023.aspx .
我查看了链接http://msdn.microsoft.com/en-us/library/ms136023.aspx中的代码。 but the package already has logging enabled and file name set to some location, I just need to be able to update the log file path to a different location dynamically by reading from config file.
但是该包已经启用了日志记录并将文件名设置到某个位置,我只需要能够通过从配置文件中读取来动态地将日志文件路径更新到不同的位置。 Please let me know how to do this.
请让我知道该怎么做。 thanks in advance.
提前致谢。
You should be able to modify the ConnectionString property of the ConnectionManager , which can be retrieved from an existing package's Connections property.您应该能够修改ConnectionManager的ConnectionString属性,该属性可以从现有包的Connections属性中检索。 For example:
例如:
Application app = new Application();
Package p = app.LoadPackage(@"C:\PathToPackage", null);
// LogFileConnection is an existing connection to a log file.
ConnectionManager c = p.Connections["LogFileConnection"] as ConnectionManager;
if (c != null)
c.ConnectionString = @"C:\SomePathToLogFile"; // Change the file path
p.Execute(); //You should now see events logged to the new file path
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.