Hi, 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. I looked at the code from the link 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.
+1
A:
You should be able to modify the ConnectionString property of the ConnectionManager, which can be retrieved from an existing package's Connections property. 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
Garett
2010-08-16 20:38:21
thanks a lot for your reply
RKP
2010-08-18 08:58:25