Message From server: 141 Can't open log file 'D:\\log.xml'

Advertisement

tdguitar
Joined:
Posts:
1
Location:
VIET NAM

Message From server: 141 Can't open log file 'D:\\log.xml'

Please help me to check this problem when logging the action by winscp from client.
I publish the sample code below in server:
        const string log_path = "log.xml";
        Process winscp = new Process();
        winscp.StartInfo.FileName = "C:\\program files\\winscp\\winscp.com ";        
        winscp.StartInfo.Arguments = "/log=D:\\" + log_path;
        winscp.StartInfo.UseShellExecute = false;
        winscp.StartInfo.RedirectStandardInput = true;
        winscp.StartInfo.RedirectStandardOutput = true;
        winscp.StartInfo.CreateNoWindow = true;
        winscp.Start();
        winscp.StandardInput.WriteLine("option batch abort");
        winscp.StandardInput.WriteLine("option confirm off");

        winscp.StandardInput.WriteLine("open mysession");
        winscp.StandardInput.WriteLine("ls ");
        
        winscp.StandardInput.Close();
        string output = winscp.StandardOutput.ReadToEnd();
        winscp.WaitForExit();    
But the value of output is like that when I run from client:
winscp> option batch abort
batch abort
winscp> option confirm off
confirm off
winscp> open user:pass@ip_host
141 Can't open log file 'D:\\log.xml'.

And when I check on the hard disk D in server, there's no log file created. Please check and help me ASAP.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: Message From server: 141 Can't open log file 'D:\\log.xml'

Make sure the account that runs the script has write access to C:\
_________________
Martin Prikryl

Reply with quote

Guest

I checked on the iis server that account have full access right. Please check for me that is there anything I need to check more?
The error message is " 141 Can't open log file D:\log.xml".

Thanks for reply.

Reply with quote

Guest

Okie, I found out the problem. The problem is lacking add the permission for NETWORK_SERVICE.
Thanks for your support.

Reply with quote

hinnman
Guest

I am having this problem

The weird part is that it gives the 141 can't find log file, but it still writes to the log.

tom dot owens at yahoo dot com

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: I am having this problem

hinnman wrote:

The weird part is that it gives the 141 can't find log file, but it still writes to the log.

tom dot owens at yahoo dot com
Can you send me an email, so I can send you back a debug version of WinSCP to track the problem? Please include link back to this topic in your email. Also note in this topic that you have sent the email. Thanks.

You will find my address (if you log in) in my forum profile.
_________________
Martin Prikryl

Reply with quote

Balaji
Guest

141 Can't open log file 'D:\\log.xml'

Still I am facing same error. As mentioned above i added network service account for my logs folder. Can anyone please please halp me asap. Thanks.

batch abort
winscp> option confirm off
confirm off
winscp> open sftp://xxUser@xxx.56.xxx.96:22 -privatekey="C:\FTP_Automation\privatekey.ppk"
141
Can't open log file '.\log\scpLog.xml'.
Searching for host...
Connecting to host...

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: 141 Can't open log file 'D:\\log.xml'

What is command-line you use to run WinSCP? What is startup directory of the command? What is a path to the log folder?
_________________
Martin Prikryl

Reply with quote

Balaji
Guest

Re: 141 Can't open log file 'D:\\log.xml'

martin wrote:

What is command-line you use to run WinSCP? What is startup directory of the command? What is a path to the log folder?

Thanks for your quick reply.

Actually I prepared console application,if I run manually script is working fine. when i automate using windows task scheduler the problem is happening.

I have placed my .exe in following location in a server. C:\FTP_Automation\HRIQ_OTS_FTP. The logs will generate in following location. C:\FTP_Automation\HRIQ_OTS_FTP\logs\.
I have given full access permission as well as I added Network Service account to the "HRIQ_OTS_FTP" folder.

Below is my sample winscp code.

winscp = new Process();
winscp.StartInfo.FileName = ClientPath;
winscp.StartInfo.Arguments = "/log=" + ClientLog;
winscp.StartInfo.UseShellExecute = false;
winscp.StartInfo.RedirectStandardInput = true;
winscp.StartInfo.RedirectStandardOutput = true;
winscp.StartInfo.CreateNoWindow = true;
winscp.Start();
winscp.StandardInput.WriteLine("option batch abort");
winscp.StandardInput.WriteLine("option confirm off");
winscp.StandardInput.WriteLine(string.Format("open sftp://{0}@{1}:{2} -privatekey=\"{3}\"", HostUser, HostIP, HostPort, PrivateKey));
winscp.StandardInput.WriteLine(string.Format("StartInfo Argument {0}", winscp.StartInfo.Arguments.ToString()));
winscp.StandardInput.WriteLine(string.Format("cd {0}", HostRoot));
winscp.StandardInput.WriteLine(string.Format("lcd {0}", ClientRoot));
winscp.StandardInput.WriteLine("option transfer binary");

out put:
winscp> option confirm off
confirm off
winscp> open sftp://hriqftp@210.56.134.96:22 -privatekey="C:\FTP_Automation\HRIQFTPKeys\privatekey.ppk"
141
Can't open log file '.\log\scpLog.xml'.
Searching for host...
Connecting to host...
Authenticating...
Using username "hriqftp".
Authenticating with public key "rsa-key-201xxx22".
Authenticated.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,253
Location:
Prague, Czechia

Re: 141 Can't open log file 'D:\\log.xml'

EXE location is not the same as startup/working directory. Try setting winscp.StartInfo.WorkingDirectory. Also try using absolute path to an INI file.
_________________
Martin Prikryl

Reply with quote

Balaji
Guest

Re: 141 Can't open log file 'D:\\log.xml'

martin wrote:

EXE location is not the same as startup/working directory. Try setting winscp.StartInfo.WorkingDirectory. Also try using absolute path to an INI file.

Thank you very much Martin Prikryl. Its working fine after I set the winscp.StartInfo.WorkingDirectory= path of exe folder.

Once again Thank you very much. You saved lot of my time.

Regards,
Balaji

Reply with quote

Advertisement

You can post new topics in this forum