#44 System.out handling

open-postponed
nobody
None
1
2001-10-24
2001-10-22
No

Many things, not just poorly written debugging code,
write to System.out and/or System.err. It would be
nice to have access to those streams when, for
example, working under Windows with the bsh GUI
console.

While I can do a
java.lang.System.setOut(this.interpreter.getOut());
java.lang.System.setErr(this.interpreter.getErr());
in my %USERPROFILE%/.bshrc, this has the problem that
a System.out() from different workspaces all end up in
the last workspace window I opened - this means that
quickly opening a new workspace and then closing it
(say to check some side calculation) has the side
effect of sending your output off to nowhere.

I want a PrintStream that will direct to the
appropriate Interpreter's output. I could then do:

java.lang.System.setOut(bsh.Interpreter.getGlobalOut
());
java.lang.System.setErr(bsh.Interpreter.getGlobalErr
());

in my .bshrc and have the GUI console windows behave
as one would expect them to.

Failing that, I'd like to have separate windows for
System.out and System.err -- at least then I won't
accidentally lose all of the output by opening up a
new workspace and closing it, even if I do have the
problem of having all the outputs comingled.

Discussion

  • Pat Niemeyer

    Pat Niemeyer - 2001-10-24
    • priority: 5 --> 1
    • status: open --> open-postponed
     
  • Pat Niemeyer

    Pat Niemeyer - 2001-10-24

    Logged In: YES
    user_id=18885

    First, I should note that the console windows each have a
    menu option to capture stdin/stdout in the window and when
    they are closed they relinquish it properly to the original.

    But the general point is taken. We'd have to replace
    System.out/in with our own stream that associates bsh
    interpreter threads with workspaces and everything else
    with standard. We can probably do this... being careful
    to handle the case where we don't have permission to set it
    of course.

    If you'd like to create this I'll take a look at it.

    Thanks,
    Pat

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks