Unable to create log file error

Advertisement

Lee M
Guest

Unable to create log file error

Using WinSCP .NET assembly, I'm getting this error:
2021-05-04 15:24:39,529 [1] ERROR Helpers.SftpProcessor - WinSCP.SessionLocalException: WinSCP process terminated with exit code 1. Error output was "Can't open log file 'C:\Users\Lee M\AppData\Local\Temp\2\wscp2FB8.0259F9D2.tmp'.
System Error. Code: 2.
The system cannot find the file specified
Error occurred during logging. Cannot continue.". Response log file C:\Users\Lee M\AppData\Local\Temp\2\wscp2FB8.0259F9D2.tmp was not created. This could indicate lack of write permissions to the log folder or problems starting WinSCP itself.
at WinSCP.Session.Open(SessionOptions sessionOptions)
at Helpers.SftpProcessor.SetUpRemoteFolderStructure() in C:\Repos\SftpProcessor\Main\SftpProcessor\Helpers\SftpProcessor.cs:line 291
It works if I run the command prompt as administrator. Is there a way to change the location WinSCP uses to log?
Thanks,
Lee

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Unable to create log file error

Wouldn't it be better to fix your local account set up? You must have other problems, if its TEMP point to a folder that does not exist.
Anyway, there's an undocumented Session.XmlLogPath property.

Reply with quote

Safwan
Guest

Same Issue

I have the same issue, there is nothing wrong with my user profile, the tmp folder exists and I can manually create a file in that folder, something else is at play here.

Reply with quote

Safwan
Guest

Solved

I had the same issue; the problem was not in my user profile. My script would run fine sometimes and other times it would error out with the same error message in this topic. What I found out is that when it failed, I had an Edge window open (to this site), which happens to be also creating and locking some files in the same TMP directory, if I close my Edge browser window, the locked files created in the TMP folder by that window are deleted, and when I run the script, it works just fine. I also tried deleting the TMP folder and making sure I close all browser windows and then run the script, it works, it even recreates the TMP folder.

Reply with quote

Advertisement

You can post new topics in this forum