This is a discussion on Output to the log file with XP_CMDSHELL within the SQL Server forums, part of the Microsoft SQL Server category; --> Hi Folks, I am using an xp_cmdshell sp to start a C# app. This app downloads data files and ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi Folks, I am using an xp_cmdshell sp to start a C# app. This app downloads data files and imports them into DB. It has a logging functionality built-in and when executed from the command line or WE, it records it's progress into a log TXT file. But when executed via xp_cmdshell, it doesn't write into its log file. Is it possible to enable it to write into a log file with xp_cmdshell? Should I be using a different extended sp to accomplish that? Any help will be greatly appreciated. Thank you, Narine |
| |||
| Narine (narine.kostandyan@prurealty.com) writes: > I am using an xp_cmdshell sp to start a C# app. This app downloads > data files and imports them into DB. It has a logging functionality > built-in and when executed from the command line or WE, it records > it's progress into a log TXT file. But when executed via xp_cmdshell, > it doesn't write into its log file. > > Is it possible to enable it to write into a log file with xp_cmdshell? > Should I be using a different extended sp to accomplish that? Maybe you are looking for the log file in the wrong place? How does the C# app determine where to write? The current directory when you run xp_cmdshell is SYSTEM32 on the server machine. Apart from the logging, does the app do its job? -- Erland Sommarskog, SQL Server MVP, sommar@algonet.se Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp |
| |||
| Thank you for replying, Erland. C# app works fine, we've had it running as a scheduled task for a while. The problem is after this app runs successsfully we need to execute a DTS package. Until now it's been running as two independent processes. DTS is scheduled to run a little after the app. I wanted to create a stored procedure that will execute an app and on success execute DTS package. This will not only ensure that DTS will run on success but also will require only one job scheduled. However, we do need to look at the C# app logs to understand errors better. Another alternative would be to write a VB script that will execute the app then use dtsrun utility to execute the package. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
| |||
| Narine Kostandyan (narine.kostandyan@prurealty.com) writes: > Thank you for replying, Erland. > C# app works fine, we've had it running as a scheduled task for a while. > The problem is after this app runs successsfully we need to execute a > DTS package. Until now it's been running as two independent processes. > DTS is scheduled to run a little after the app. I wanted to create a > stored procedure that will execute an app and on success execute DTS > package. > This will not only ensure that DTS will run on success but also will > require only one job scheduled. > However, we do need to look at the C# app logs to understand errors > better. > Another alternative would be to write a VB script that will execute the > app then use dtsrun utility to execute the package. OK, if the C# app runs well, I would assume that is also writing its logs properly. I mean, if that particular part would fail, the application would fail too, wouldn't it? In case it doesn't, write some error-checking where you open the log file, and print an error message to standard output - this would become a result set from xp_cmdshell. -- Erland Sommarskog, SQL Server MVP, sommar@algonet.se Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp |
| ||||
| An executable can be a job step. The only trick is that you have to make it finish with a return value that Agent can understand as success or failure. On 28 Apr 2004 23:56:53 GMT, Narine Kostandyan <narine.kostandyan@prurealty.com> wrote: > > >Thank you for replying, Erland. >C# app works fine, we've had it running as a scheduled task for a while. >The problem is after this app runs successsfully we need to execute a >DTS package. Until now it's been running as two independent processes. >DTS is scheduled to run a little after the app. I wanted to create a >stored procedure that will execute an app and on success execute DTS >package. >This will not only ensure that DTS will run on success but also will >require only one job scheduled. >However, we do need to look at the C# app logs to understand errors >better. >Another alternative would be to write a VB script that will execute the >app then use dtsrun utility to execute the package. > > >*** Sent via Developersdex http://www.developersdex.com *** >Don't just participate in USENET...get rewarded for it! |