简体   繁体   中英

Java printwriter

I have a proxy class, that receives a request and send the request to another server and gets the response and directs it back to original requestor. I use a socket to connect to the server and use Printwriter to write to it. Something like this

    private PrintWriter out;

    public void writeString( String message ) throws IOException {
        openStreams();
        out.print( message);
        out.flush();
    }

I start the proxy and send request to server via proxy. The problem is I see a lot of these request/response in the console of the proxy. Is there is a different way of doing this, where the console is left cleaner. I am new to socket programing

Thanks in advance

It sounds like you have a System.out.println or debug logging statement somewhere else in your code. Do a quick text-search through your various java files and search for System.out statements. If you are using some logging framework like log4j/slf4j, check if you are logging something at an inappropriate level (info instead of debug maybe) and tune your logger config to appropriate lever and/or log to file instead of console.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM