Knowledgebase: Java
How to redirect debug logs to a file when using classes from Java Component APIs?
Posted by Daniel Demecillo II on 20 December 2011 04:14 PM

Most client component class (Ftp, Ftps, Sftp, Scp, Http, etc.) within the various Java Component APIs write debug logs into the console by default when debug is enabled. If you want them to write to a file instead, you can do so by calling the setDebugStream method passing a PrintStream instance as parameter. Below is a code snippet showing how this is accomplished for Sftp

PrintStream debugStream = new PrintStream(new FileOutputStream("sftp.log"));
....
sftp.setDebug(true);
sftp.setDebugStream(debugStream);
....

(3 vote(s))
This article was helpful
This article was not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below. This is required to prevent automated registrations and form submissions.

Help Desk Software by Kayako fusion