How to get FTP/SFTP Instance Id for Logging?

0 votes
asked Sep 30 by lanopk (1,070 points)

Hi.

I would like to do detailed tracing while using FTP/SFTP.
When I look at the log of FTP/SFTP's LogWriter, there is an Instance ID, and I want to record the same Intance ID in my log or LogWriter.Write.
Can I get the InstanceID of the FTP?

2020-09-30 14:01:18.965 DEBUG Ftp(2)[39] Info: Data transfer started.

LogWriter.Write(Rebex.LogLevel.Debug, typeof(Ftp), ???, "MYLOG", format);

Thank you.
Bookyung Oh

Applies to: Rebex FTP/SSL, Rebex SFTP

1 Answer

0 votes
answered Sep 30 by Lukas Pokorny (115,410 points)

Hi,

There is InstanceId property, but it's currently protected. To work around this, consider inheriting a custom class from Ftp and adding a property that makes it accessible, and use the class in your code instead of Ftp:

public class MyFtp : Ftp
{
    public int Id
    {
        get { return InstanceId; }
    }
}
commented Sep 30 by lanopk (1,070 points)
edited Sep 30 by lanopk
In Rebex 2020R3, Ftp class does not have InstanceId.

In NetworkSession class,

protected internal int myxbq { get; } <-- is InstanceId?

Code Obfuscation?
commented Sep 30 by Lukas Pokorny (115,410 points)
Oops, this seems to have slipped into R3 by mistake. We'll fix it as soon as possible and publish a new release. Sorry for the inconvenience!
commented Oct 1 by Lukas Pokorny (115,410 points)
We have just released 2020 R4 which fixes this issue.
...