开发者社区> 问答> 正文

日志升级到log4j2输出到Logstash就报错?报错


项目里日志升级到log4j2 后输出日志到日志系统就不行了,求大神指点一下

log4j2.xml配置:

<configuration status="info">
	
        <Socket name="socket" host="10.1.21.1" port="4567" >
	      <SerializedLayout />
	    </Socket>
	</appenders>

	<loggers>
		<logger name="com.test" level="info"></logger>
		<Root level="info">
	     	<AppenderRef ref="socket"/>
	    </Root>
        
	</loggers>

</configuration>



错误异常:

2016-12-16 11:34:40,503 AsyncAppender-Async ERROR Unable to write to stream TCP:10.1.21.1:4567 for appender socket: org.apache.logging.log4j.core.appender.AppenderLoggingException: Error writing to TCP:10.1.21.1:4567
2016-12-16 11:34:40,506 AsyncAppender-Async ERROR An exception occurred processing Appender socket org.apache.logging.log4j.core.appender.AppenderLoggingException: Error writing to TCP:10.1.21.1:4567
	at org.apache.logging.log4j.core.net.TcpSocketManager.write(TcpSocketManager.java:143)
	at org.apache.logging.log4j.core.appender.OutputStreamManager.write(OutputStreamManager.java:197)
	at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.writeByteArrayToManager(AbstractOutputStreamAppender.java:185)
	at org.apache.logging.log4j.core.appender.SocketAppender.directEncodeEvent(SocketAppender.java:424)
	at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.tryAppend(AbstractOutputStreamAppender.java:169)
	at org.apache.logging.log4j.core.appender.AbstractOutputStreamAppender.append(AbstractOutputStreamAppender.java:160)
	at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:156)
	at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:129)
	at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:120)
	at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:84)
	at org.apache.logging.log4j.core.appender.AsyncAppender$AsyncThread.callAppenders(AsyncAppender.java:451)
	at org.apache.logging.log4j.core.appender.AsyncAppender$AsyncThread.run(AsyncAppender.java:404)
Caused by: java.net.SocketException: Broken pipe
	at java.net.SocketOutputStream.socketWrite0(Native Method)
	at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
	at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
	at org.apache.logging.log4j.core.net.TcpSocketManager.write(TcpSocketManager.java:133)









展开
收起
爱吃鱼的程序员 2020-06-08 20:01:38 1353 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    遇到同样的问题了,请问解决了吗?没有搞定!!然后用flume了

    logstash没有集成log4j2插件,集成下插件配置下想关配置就可以了。

    2020-06-08 20:01:54
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
PostgresChina2018_赖思超_PostgreSQL10_hash索引的WAL日志修改版final 立即下载
Kubernetes下日志实时采集、存储与计算实践 立即下载
日志数据采集与分析对接 立即下载