日志升级到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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
logstash没有集成log4j2插件,集成下插件配置下想关配置就可以了。
没有搞定!!然后用flume了
遇到同样的问题了,请问解决了吗?