fluent/fluent-logger-java

NullPointerException when the Fluentd server is down

khalilamdouni opened this issue · 0 comments

When We try to use the Fluentd java logger it throws the fellowing NullPointerException when the Fluentd server is down:

An exception occurred processing Appender fluentd java.lang.NullPointerException at org.fluentd.logger.sender.RawSocketSender.flushBuffer(RawSocketSender.java:158) at org.fluentd.logger.sender.RawSocketSender.send(RawSocketSender.java:168) at org.fluentd.logger.sender.RawSocketSender.emit(RawSocketSender.java:149) at org.fluentd.logger.sender.RawSocketSender.emit(RawSocketSender.java:131) at org.fluentd.logger.sender.RawSocketSender.emit(RawSocketSender.java:126) at org.fluentd.logger.FluentLogger.log(FluentLogger.java:101) at org.fluentd.logger.FluentLogger.log(FluentLogger.java:86)

The source of the problem is that when the Fluentd server is down the socket in the RawSocketSender object is null so the call to the method RawSocketSender.flushBuffer#Line:152 throws the null pointer exception when executing the fellowing instruction (RawSocketSender.flushBuffer#Line:158):
LOG.error("Cannot send logs to " + socket.getInetAddress().toString());