代码之家  ›  专栏  ›  技术社区  ›  Justin

从jetty到stderr的神秘控制台输出?

  •  1
  • Justin  · 技术社区  · 14 年前

    当运行我的嵌入式jettywebapplauncher时,我看到了stderr的以下输出。我刚开始看到这个后,我把我的建设maven-2。有人见过这个吗?

    IDLE SCEP@988057 [d=false,io=1,w=true,rb=false,wb=false],NOT_HANDSHAKING, in/out=0/0 Status = OK HandshakeStatus = NOT_HANDSHAKING
    bytesConsumed = 5469 bytesProduced = 5509
    

    它偶尔重复,似乎是随机的。

    1 回复  |  直到 14 年前
        1
  •  2
  •   Justin    14 年前

    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.checkIdleTimestamp(SelectChannelEndPoint.java:231)
    at org.eclipse.jetty.io.nio.SelectorManager$SelectSet$2.run(SelectorManager.java:768)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
    

    对于那些有类似问题的人,我做得太多了系统错误使用模拟输出流:

    public class DebugOutputStream extends OutputStream {
        private Logger s_logger = LoggerFactory.getLogger(DebugOutputStream.class);
    
        private final OutputStream m_realStream;
        private ByteArrayOutputStream baos = new ByteArrayOutputStream();
        private Pattern m_searchFor;
    
        public DebugOutputStream(OutputStream realStream, String regex) {
            m_realStream = realStream;
            m_searchFor = Pattern.compile(regex);
        }
    
        public void write(int b) throws IOException {
            baos.write(b);
            if (m_searchFor.matcher(baos.toString()).matches()) {
                s_logger.info("unwanted output detected", new RuntimeException());
            }
            if (b == '\n') baos.reset();
            m_realStream.write(b);
        }
    }