Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: SessionLogPath and rotating files

Placeholders are not supported in .NET assembly. They make sense in global WinSCP preferences, where the path is configured once for all (GUI) sessions. But in .NET assembly, the path is configured for one specific session. So you know what session and what time you are configuring the path for. So you can put anything you want to that path/filename in your own code.

I believe that Session.DebugLogLevel overrides the Logging\LogProtocol. But I wouldn't rely on it. Use just one of them.
cosb

Just to answer this question, having:
 _session.AddRawConfiguration("Logging\\LogMaxSize","1048576");   
 _session.AddRawConfiguration("Logging\\LogMaxCount","1000");

Does the trick, i.e. it splits the file. I assume that it will honor the LogMaxCount setting as well.

The remaining questions are about the placeholders and the log level.

Thank you
cosb

SessionLogPath and rotating files

Hi,
I would like to set the SessionLogPath occasionally in case I experience issues, and I was wondering about configuring the rotation for the files, as well as the placeholders that can be part of the file name.

Based on this documentation, https://winscp.net/eng/docs/ui_pref_logging, one can set up the session log file as well as the file rotating parameters, but that's done in the WinScp UI.

How do I set the same for the WinSCP .NET component? Should I do it through the raw config settings under logging: https://winscp.net/eng/docs/rawconfig?

Setting something like:
session.SessionLogPath = "!S_!Y!M!D_!T.txt";
doesn't work as expected, in the sense that the WinSCP component does not replace the placeholders with the actual values. A file with that exact name is created instead.

re: log level, there is DebugLogLevel and there is the raw config under Logging\LogProtocol. Which one takes precedence?

re: log ration and max size and the others, if I set
session.SessionLogPath = "session_log_SomeSite.txt";
does the WinSCP component look at that file and it will split it if necessary? If I decide to use
session.SessionLogPath = "session_log_SomeOtherSite.txt";
I assume it is going to split this one?

Thank you!