.NET assembly does not save the xml log file

Advertisement

gkr
Joined:
Posts:
3

.NET assembly does not save the xml log file

Hello,
There is something I don't understand with .NET assembly and a powershell script.
Here is an excerpt of the said script:

# 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:

[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:

[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,

Reply with quote

Advertisement

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

Re: .NET assembly does not save the xml log file

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.

Reply with quote

gkr

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 ?

Reply with quote

Advertisement

tgurinder
Joined:
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.

Reply with quote

martin
Site Admin
martin avatar

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.

Reply with quote

Advertisement

You can post new topics in this forum