You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Jerome @ BBC" <je...@deesse.bbc.no> on 2003/03/11 13:07:16 UTC

input task: message not printed when using Log4jListener logger and -quiet output

When using the log4jlistener task configured with no Console output, 
input tasks messages will not be printed while the ones for the echo 
tasks are.

This is probably because the DefaultInputHandler uses System.err to 
print its message:

    /**
     * Prompts and requests input.  May loop until a valid input has
     * been entered.
     */
    public void handleInput(InputRequest request) throws BuildException {
        String prompt = getPrompt(request);
        BufferedReader in =
            new BufferedReader(new InputStreamReader(getInputStream()));
        do {
            System.err.println(prompt);
            try {
                String input = in.readLine();
                request.setInput(input);
            } catch (IOException e) {
                throw new BuildException("Failed to read input from 
Console.",
                                         e);
            }
        } while (!request.isInputValid());
    }

while the Task uses the log() method of a project with a default warning 
level.
Cf: Task.java

     * <p>The default is &quot;warning&quot; to ensure that messages are
     * displayed by default when using the -quiet command line option.</p>
    */
    public void setLevel(EchoLevel echoLevel) {

It seems like the DefaultInputHandler is innapropriate to use in 
conjunction with the Log4j logger.

Jerome