t0xa / gelfj

Graylog Extended Log Format (GELF) implementation in Java and log4j appender without any dependencies.
https://github.com/t0xa/gelfj/wiki
Other
186 stars 116 forks source link

GelfAppender::close() throws NPE on update if Graylog was not available before #90

Closed ogross74 closed 8 years ago

ogross74 commented 9 years ago

in case Graylog server wasn't available and now the log4j property file changes (with "watch"), the close method will fail on NPE. Here's the fix:

public class MyGelfAppender extends GelfAppender {

    @Override
    public void close() {
        GelfSender x = this.getGelfSender();
        if (x != null) {
            x.close();
        }
    }
}
t0xa commented 8 years ago

Version 1.1.14 with fixed released.