Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.5k views
in Java FTP by (220 points)
I would like to capture the Info, Debug output messages that go to the console in a string or stream so I can add the information to an email. (Java)

2 Answers

0 votes
by (162k points)
Logger.addAppender(new StreamAppender(myStream));
0 votes
by (220 points)
Thanks for your quick reply. Sorry for not fully grasping, am somewhat new to Java and ftp using "Edtftpj".
For testing and a better understanding have created 3 Appenders:

Logger.setLevel(Level.ALL);
Logger.addAppender(new FileAppender("c:\\output.log"));
Logger.addAppender(new StandardOutputAppender());
Logger.addAppender(new StreamAppender(Edtftpj.outStream));

I have set up the outStream and a get method:

public String getOutStream() {
return outStream.toString();
}

private static OutputStream outStream = new OutputStream() {
private StringBuilder string = new StringBuilder();
public void write(int b) throws IOException {
this.string.append((char) b );
}

public String toString(){
return this.string.toString();
}
};

But it returns nothing. What am I doing wrong?

Categories

...