@Override
public Appender<ILoggingEvent> build(LoggerContext context, String applicationName, Layout<ILoggingEvent> layout) {
checkNotNull(context);
final GelfAppender appender = new GelfAppender();
appender.setContext(context);
appender.setFacility(facility.or(applicationName));
appender.setGraylog2ServerHost(host);
appender.setGraylog2ServerPort(port);
appender.setGraylog2ServerVersion(serverVersion);
appender.setMessagePattern(messagePattern);
appender.setShortMessagePattern(shortMessagePattern);
appender.setUseLoggerName(useLoggerName);
appender.setUseThreadName(useThreadName);
appender.setChunkThreshold(chunkThreshold);
appender.setAdditionalFields(additionalFields);
appender.setStaticAdditionalFields(staticFields);
appender.setFieldTypes(fieldTypes);
appender.setIncludeFullMDC(includeFullMDC);
appender.setUseMarker(useMarker);
if(hostName.isPresent()) {
appender.setHostName(hostName.get());
}
addThresholdFilter(appender, threshold);
appender.start();
return wrapAsync(appender);
}