Using Session.SessionLogPath does not trigger Log File Rotation

Advertisement

roberestarkk
Guest

Using Session.SessionLogPath does not trigger Log File Rotation

I am using Session.SessionLogPath to set the log file to <fileName>.log in C:/WINSCP/logs/

I have tried setting the Max Size and Max Count settings in both the ini file and via sessionOptions.AddRawSettings, using a small value of 100 bytes or so to test immediately, and neither setting applies rotation to the log file. It just continues to grow.

I have even tried appending the Session name via <fileName>_!S but that just comes out as a literal _!S in the filename.

Am I missing something, or is it just not possible to rotate logs in this manner?

Reply with quote

Advertisement

roberestarkk
Guest

Ah right, thank you.

Unfortunately that doesn't have any effect either.
I set the following:
session.AddRawConfiguration("LogMaxSize","80000");
session.AddRawConfiguration("LogMaxCount", "5");

figuring LogMaxSize is in bytes by setting 1M in GUI and having it represented in the INI as a MB worth of bytes, I set it to 80,000 which is around 10KB.

And yet:
The file is sitting there at 141KB and counting, without having rotated.

Unless there's a validation somewhere in WinSCP that says the minimum value in the GUI (1MB) is the minimum viable value even when manually set (which I will test, but the file will take much longer to reach that size in the dev environment), I don't believe it's working.

Reply with quote

Advertisement

roberestarkk
Guest

AH!
That's what I was missing!

I assumed it worked the same as .addRawSettings which just takes the base key name.
Though now I think on it, probably addRawSettings is just addRawConfiguration with "Settings\" prepended automatically or something.

Thanks for your help!

Reply with quote

Advertisement

You can post new topics in this forum