从示例应用程序发送日志时,所有日志都会丢失并显示错误: 00:06:57,103 | -WARN in net.logstash.logback.appender.LogstashTcpSocketAppender [tcp-logstash] - 由于环路buf丢弃了129001个事件(并且计数...) 最大容量的铁[8192]
在logback.xml文件中将缓冲区大小增加到“32768”但是没有运气。使用以最大容量显示的新新buffere大小获得相同的错误[32768]
N.B:我可以使用log4j2 TcpSocketAppender发送相同的日志集,没有任何问题。
答案 0 :(得分:0)
尝试添加ShortenedThrowableConverter,
import net.logstash.logback.appender.LogstashTcpSocketAppender;
import net.logstash.logback.encoder.LogstashEncoder;
import net.logstash.logback.stacktrace.ShortenedThrowableConverter;
ShortenedThrowableConverter throwableConverter = new ShortenedThrowableConverter();
throwableConverter.setRootCauseFirst(true);
LogstashEncoder encoder = new LogstashEncoder();
encoder.setThrowableConverter(throwableConverter);
在xml
中 <throwableConverter class="net.logstash.logback.stacktrace.ShortenedThrowableConverter">
<maxDepthPerThrowable>20</maxDepthPerThrowable>
<maxLength>1000</maxLength>
<shortenedClassNameLength>30</shortenedClassNameLength>
<rootCauseFirst>true</rootCauseFirst>
<exclude>excluded1</exclude>
<exclude>excluded2</exclude>
<inlineHash>true</inlineHash>
</throwableConverter>