简体   繁体   中英

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

I am trying to implement socket appender in log4j, so that my logs get directly written to host application.

Below is my log4j config,

    <?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>

I have also tried sending messages to this localhost 8085 port from java program, which works perfectly fine.

But with log4j appender, I get below exception,

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]

Looking at the class name org.mule.module.http.internal.HttpMessageLogger you see an .internal. package. That is a strong hint that you should not be using that package at all.

What is happening is that you are using an internal Mule implementation class as a Log4j2 custom appended for Splunk. That is not the intended usage for that class in any case.

What you should be doing is looking at Splunk documentation and following the steps there.

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