Debug Log path access issue

Advertisement

dfinch
Joined:
Posts:
2
Location:
UK

Debug Log path access issue

Hi, I am trying to set the debug log file path in C# using:

session.DebugLogLevel = 2;
session.DebugLogPath = @"C:\temp\sync\logs\debug";

However this results in the following error message:

Error: System.UnauthorizedAccess Exception: Access to the path 'C:\temp\sync\logs\debug' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
at System.IO.StreamWriter..ctor(String path, Boolean append)
at System.IO.File.CreateText(String path)
at WinSCP.Logger.SetLogPath(String value)
at WinSCP.Session.set_DebugLogPath(String value)
at WinScp2.Program.Main(String[] args) in C:\test\WinScp2\WinScp2\Program.cs:line 36

I am running visual studio as an administrator, and my user has full access to the folder C:\temp\sync\logs\debug. :(

Any help with this would be gratefully received. :)

Reply with quote

Advertisement

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

Re: Debug Log path access issue

It's path to a log file, not to log file folder.

So it should be like:
session.DebugLogPath = @"C:\temp\sync\logs\debug\debug.log";

Reply with quote

Advertisement

You can post new topics in this forum