Skip to main content
gamedev.net
🔒 Locked

[java] Changing Error stream?

Started by H_o_p_s Mar 18, 2005 at 8:57 PM 2 replies 750+ views
Original Post
H_o_p_s
H_o_p_s
Is there a way to reroute or capture the error stream? As far as I know errors are printed to System.out. For my logging program I want to capture everything from System.out to a JTextArea... currently I do something like log.add("logged message"); which simple appends to a text area. Thanks!
BRING BACK THE BLACK (or at least something darker)
Addictman
Addictman
Hi.

There is a setErr(PrintStream errorStream), a setIn(Inputstream inStream), and
a setOut(PrintStream out) method in the System class. These methods rearrange the streams. So, more specifically you can rearrange your error stream with
the setErr method. Note however, that normal "output" and "errors" are two different things.

Cheers.
Development blog, The Omega Sector -- http://www.omegasector.org
HellCreator
HellCreator
Yes and it is simple :)

http://javaalmanac.com/egs/java.lang/Redirect.html
and interesting consoles type
http://javaalmanac.com/egs/javax.swing.text/ta_Console.html

more then this?
just to accomodate to Your needs

AND HAVE A HAPPY BIRTHDAY
WITH BEST REGARDS
LOVE HEALTH AND SUCCESS
Can't be root?Reboot!mount -r /home/hell
H_o_p_s
H_o_p_s
Thanks you guys!! This helps a bunch. [smile]
BRING BACK THE BLACK (or at least something darker)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.