有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

由以下原因引起的socket:java。伊奥。IOException:长度1279873876超出限制:26

我试图在log4j中实现socket appender,以便将日志直接写入宿主应用程序

下面是我的log4j配置

    <?xml version="1.0" encoding="UTF-8"?>
  <Configuration status="trace" monitorInterval="5">
    <Appenders>
      <Socket name="socket" host="localhost" port="8085" reconnectDelayMillis="30000" protocol="TCP" immediateFlush="true">
        <PatternLayout></PatternLayout>
      </Socket>
      <Async name="SplunkAsync">
        <AppenderRef ref="socket"/>
      </Async>
    </Appenders>
    <Loggers>
      <Root level="warn">
        <AppenderRef ref="SplunkAsync"/>
      </Root>
      <Logger name="org.mule.module.http.internal.HttpMessageLogger" level="debug" additivity="false">
        <AppenderRef ref="SplunkAsync"/>
      </Logger>
  </Loggers>
</Configuration>

我还尝试过从java程序向这个localhost 8085端口发送消息,它工作得非常好

但对于log4j appender,我得到了以下例外

Caused by: java.io.IOException: Length 1279873876 exceeds limit: 26

ERROR 2018-10-10 19:55:52,897 [[tcplistner].connector.tcp.mule.default.receiver.02] org.mule.exception.DefaultSystemExceptionStrategy: Caught exception in Exception Strategy: An error occurred while verifying your connection.  You may not be using a consistent protocol on your TCP transport. Please read the documentation for the TCP transport, paying particular attention to the protocol parameter.
java.io.IOException: An error occurred while verifying your connection.  You may not be using a consistent protocol on your TCP transport. Please read the documentation for the TCP transport, paying particular attention to the protocol parameter.
    at org.mule.transport.tcp.protocols.SafeProtocol.helpUser(SafeProtocol.java:110) ~[mule-transport-tcp-3.8.5.jar:3.8.5]
    at org.mule.transport.tcp.protocols.SafeProtocol.assertSiblingSafe(SafeProtocol.java:83) ~[mule-transport-tcp-3.8.5.jar:3.8.5]
    at org.mule.transport.tcp.protocols.SafeProtocol.read(SafeProtocol.java:37) ~[mule-transport-tcp-3.8.5.jar:3.8.5]
    at org.mule.transport.tcp.TcpMessageReceiver$TcpWorker.getNextMessage(TcpMessageReceiver.java:367) ~[mule-transport-tcp-3.8.5.jar:3.8.5]
    at org.mule.transport.AbstractReceiverResourceWorker.doRun(AbstractReceiverResourceWorker.java:41) ~[mule-core-3.8.5.jar:3.8.5]
    at org.mule.transport.AbstractReceiverWorker.run(AbstractReceiverWorker.java:66) ~[mule-core-3.8.5.jar:3.8.5]
    at org.mule.transport.TrackingWorkManager$TrackeableWork.run(TrackingWorkManager.java:267) ~[mule-core-3.8.5.jar:3.8.5]
    at org.mule.work.WorkerContext.run(WorkerContext.java:301) ~[mule-core-3.8.5.jar:3.8.5]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_144]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_144]
    at java.lang.Thread.run(Thread.java:748) [?:1.8.0_144]
Caused by: java.io.IOException: Length 1279873876 exceeds limit: 26
    at org.mule.transport.tcp.protocols.LengthProtocol.read(LengthProtocol.java:71) ~[mule-transport-tcp-3.8.5.jar:3.8.5]
    at org.mule.transport.tcp.protocols.SafeProtocol.assertSiblingSafe(SafeProtocol.java:79) ~[mule-transport-tcp-3.8.5.jar:3.8.5]

共 (0) 个答案