I’ve been working on a GUI for my server console lately, and stumbled upon a problem:
I’d like to display the console with all System.out and logging stuff. My plan is to get that into a string and feed it into a JTextField.
Any ideas on how to get that string?
Add a log handler to the logging system to catch those messages.
To catch stdout in Java, google would probably give you a thousand hits… but it’s actually on the same class where you get System.out from… System.
But really… just google that:
Thanks, but does capturing stdout also get the log messages?
EDIT: Also, is the method of swapping the streams performant enough to be used in the simpleUpdate() of the server?
No… that’s why I already said:
If you can’t find that in javadoc or google then I can be your personal search engine for that also… but I thought maybe I’d give you a chance to flex your search muscles.
Thanks. I found the StreamHandler, it’s working pretty well.