Mute Stanford coreNLP logging

后端 未结 5 1781
深忆病人
深忆病人 2021-01-14 20:42

First of all, Java is not my usual language, so I\'m quite basic at it. I need to use it for this particular project, so please be patient, and if I have omitted any relevan

5条回答
  •  终归单人心
    2021-01-14 21:29

    I am able to solve it by setting a blank output stream to system error stream.

    System.setErr(new PrintStream(new BlankOutputStream())); // set blank error stream
    // ... Add annotators ...
    System.setErr(System.err); // Reset to default
    

    Accompanying class is

    public class BlankOutputStream extends OutputStream {
    
        @Override
        public void write(int b) throws IOException {
            // Do nothing
        }
    
    }
    

提交回复
热议问题