简体   繁体   English

Java 印刷机

[英]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.我有一个代理 class,它接收请求并将请求发送到另一台服务器并获取响应并将其引导回原始请求者。 I use a socket to connect to the server and use Printwriter to write to it.我使用套接字连接到服务器并使用 Printwriter 对其进行写入。 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.听起来您在代码的其他地方有一个 System.out.println 或调试日志记录语句。 Do a quick text-search through your various java files and search for System.out statements.对各种 java 文件进行快速文本搜索并搜索 System.out 语句。 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.如果您正在使用一些日志框架,例如 log4j/slf4j,请检查您是否在不适当的级别记录某些内容(可能是信息而不是调试)并将您的记录器配置调整到适当的杠杆和/或记录到文件而不是控制台。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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