Quantcast
Channel: SSH.NET Library
Viewing all articles
Browse latest Browse all 2955

New Post: Enabling SShNet.Logging

$
0
0
You have to use a debug build of Renci.SshNet.dll, and you need to configure a listener for the "SshNet.Logging" TraceSource in your application's config file (e.g., SftpTest.exe.config if you're running in SftpTest.exe). Here's an example that sends the trace output to the console:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
    <system.diagnostics>
        <sources>
            <source name="SshNet.Logging">
                <listeners>
                    <add name="Console" type="System.Diagnostics.ConsoleTraceListener"/>
                </listeners>
            </source>
        </sources>
    </system.diagnostics>
</configuration>
Note: SSH.NET only logs in debug builds because the "void Log(string text)" method in Session.NET.cs is marked with the [Conditional("DEBUG")] attribute. So in release builds the compiler eliminates all calls to the Log method, which means configuring a trace source listener for "SshNet.Logging" will do no good for release builds.

HTH,

Bill

Viewing all articles
Browse latest Browse all 2955

Trending Articles