Topic ".NET assembly does not save the xml log file"

Author Message
gkr
[View user's profile]

Joined: 2016-02-05
Posts: 3
Hello,
There is something I don't understand with .NET assembly and a powershell script.
Here is an excerpt of the said script:

Code:
# Set TXT assembly debug log to
$session.DebugLogPath = "C:\temp\Visualcron\Powershell\DebugLogPath.txt"
      
# Set XML transfer log files
$session.SessionLogPath = "d:\SessionLogPath.xml"
      
# Connect
$session.Open($sessionOptions)


If I set $session.SessionLogPath I get this in the $session.DebugLogPath:

Code:
[2016-02-05 15:00:25.521Z] [003e]       Starting "C:\Program Files (x86)\WinSCPautomation\winscp.exe" /xmllog="C:\Users\XX\AppData\Local\Temp\wscp1C70.00F34364.tmp" /xmlgroups /nointeractiveinput /dotnet=576  /ini=nul [color=green]/log="d:\SessionLogPath.xml"[/color]  /console /consoleinstance=_7280_6920806_341


If I don't set $session.SessionLogPath I get this in the $session.DebugLogPath:

Code:
[2016-02-05 15:01:22.868Z] [0031]       Starting "C:\Program Files (x86)\WinSCPautomation\winscp.exe" /xmllog="C:\Users\XX\AppData\Local\Temp\wscp1C70.00C12950.tmp" /xmlgroups /nointeractiveinput /dotnet=576  /ini=nul  /console /consoleinstance=_7280_61436044_343


But in either case "d:\SessionLogPath.xml" is never created. So what is the $session.SessionLogPath used for? I would have expected to have /xmllog="d:\SessionLogPath.xml" when I explicitely set it.
I would really like to keep the xml log file with all transfers because we have it too when we run WinSCP in interactive mode and we send it to Splunk for indexing.

Anyone manage to get an xml log file of the session when using the .NET Assembly?

Many thanks,
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
The WinSCP .NET assembly is using XML log file for its internal purposes. It does delete the XML log when the session is disposed.

The SessionLogPath property is to enable session logging, not XML logging.
gkr
[View user's profile]

Joined: 2016-02-05
Posts: 3
Fair enough may ask then how can I get the xml log I need to index it for compliance reasons and what is the purpose of the option sessionlogpath ?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
You cannot. All you can try to do is to copy away the temporary XML log just before you call .Dispose.

Or just log the transfers as recorded in TransferOperationResult returned from the GetFiles and PutFiles methods.
http://winscp.net/eng/docs/library_transferoperationresult

SessionLogPath: As I wrote, it enables session logging. But you cannot use .xml in the name of the session log.
gkr
[View user's profile]

Joined: 2016-02-05
Posts: 3
Okay I will look into it on Monday thanks a lot for the details.
tgurinder
[View user's profile]

Joined: 2016-02-11
Posts: 3
Location: India
gkr wrote:
Okay I will look into it on Monday thanks a lot for the details.


Try by giving ".txt" extension for SessionLogPath. I came across this when I was trying to resolve another issue.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24555
Location: Prague, Czechia
tgurinder wrote:
Try by giving ".txt" extension for SessionLogPath. I came across this when I was trying to resolve another issue.

Correct. Any extension, but .xml will do.
Advertisements

You can post new topics in this forum






Search Site

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