Topic "Debug Log path access issue"

Author Message
dfinch
[View user's profile]

Joined: 2017-05-31
Posts: 2
Location: UK
Hi, I am trying to set the debug log file path in C# using:

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


However this results in the following error message:

Quote:

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. Sad

Any help with this would be gratefully received. Smile
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 26728
Location: Prague, Czechia
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";
dfinch
[View user's profile]

Joined: 2017-05-31
Posts: 2
Location: UK
Hi Martin, thank you so much, that makes sense now Very Happy
Advertisements

You can post new topics in this forum

Search

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License