Я пытаюсь внедрить сокет appender в log4j, чтобы мои журналы напрямую записывались в хост-приложение.
Ниже приведена моя конфигурация 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>
Я также пытался отправитьсообщения на этот порт localhost 8085 от java-программы, которая прекрасно работает.
Но с приложением log4j я получаю исключение ниже,
Причина: java.io.IOException: Length1279873876 превышает лимит: 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]