Menu ▾ ▴

#136 console output always adds newline

open-wont-fix
5
2006-09-21
2006-09-21
No

I have a Java app that, under certain conditions during
startup, will prompt the user for some data. When
running my app using the -c option with JSW 3.2.0, the
output comes out on the console, however, my prompts
are ending with a newline. I think wrapper is adding a
\n after each line of console output. For example, if
this is what my Java output is (where the <XXX> is the
user-entered data typed in from the keyboard) when
running without JSW:

Starting my app
Please enter your name: <XXX>
Please enter your id: <XXX>

I'm getting this when running with JSW:

Starting my app
Please enter your name:
<XXX>

Please enter your id:
<XXX>

Can we provide an option to tell JSW to respect the
end-of-line characters coming from the JVM output? For
example:

wrapper.console.append-newline=true|false

Where if this is true, it behaves like it does today
(that is, a newline is added to all console messages -
this would be the default value to provide backwards
capability).

If false, however, the wrapper should not append a
newline - it should assume the JVM output will provide
any newlines that need to be there, and not put
newlines where there are none. We'd have to worry
about flushing the output (since typically a \n forces
a flush) - I would expect the flush to automatically
occur if a line of output doesn't end with a \n.

Discussion

  • Leif Mortenson

    Leif Mortenson - 2006-09-21

    Logged In: YES
    user_id=228081

    John,
    This is a known artifact of the way the wrapper handles
    logging. It is not possible to capture and log only a
    portion of a line of output.

    The alternative would be to always delay logging until the
    line feed shows up. But then you would never see your
    prompts in the first place.

    If I treated console output specially, then it would be
    possible that the user could end up with log output in the
    console showing up in a different order than that in the log
    file.

    I will give this some more thought, but when I thought of
    this in the past, I couldn't come up with any ways to
    implement this without causing other problems.

    Cheers,
    Leif

     
  • Leif Mortenson

    Leif Mortenson - 2006-09-21
    • labels: --> Integration
    • assigned_to: nobody --> mortenson
    • status: open --> open-wont-fix
     

Log in to post a comment.