public static GelfSender createSender(GelfSenderConfiguration senderConfiguration) {

        ErrorReporter errorReporter = senderConfiguration.getErrorReporter();
        if (senderConfiguration.getHost() == null) {
            senderConfiguration.getErrorReporter().reportError("GELF server hostname is empty!", null);
        } else {

            try {
                for (GelfSenderProvider provider : SenderProviderHolder.getSenderProvider()) {
                    if (provider.supports(senderConfiguration.getHost())) {
                        return provider.create(senderConfiguration);
                    }
                }
                senderConfiguration.getErrorReporter().reportError("No sender found for host " + senderConfiguration.getHost(),
                        null);
                return null;
            } catch (UnknownHostException e) {
                errorReporter.reportError("Unknown GELF server hostname:" + senderConfiguration.getHost(), e);
            } catch (SocketException e) {
                errorReporter.reportError("Socket exception: " + e.getMessage(), e);
            } catch (IOException e) {
                errorReporter.reportError("IO exception: " + e.getMessage(), e);
            }
        }

        return null;
    }
public static GelfSender createSender ( GelfSenderConfiguration senderConfiguration ) { ErrorReporter errorReporter = senderConfiguration . getErrorReporter ( ) ; if ( senderConfiguration . getHost ( ) == null ) { senderConfiguration . getErrorReporter ( ) . reportError ( "GELF server hostname is empty!" , null ) ; } else { try { for ( GelfSenderProvider provider : SenderProviderHolder . getSenderProvider ( ) ) { if ( provider . supports ( senderConfiguration . getHost ( ) ) ) { return provider . create ( senderConfiguration ) ; } } senderConfiguration . getErrorReporter ( ) . reportError ( "No sender found for host " + senderConfiguration . getHost ( ) , null ) ; return null ; } catch ( UnknownHostException e ) { errorReporter . reportError ( "Unknown GELF server hostname:" + senderConfiguration . getHost ( ) , e ) ; } catch ( SocketException e ) { errorReporter . reportError ( "Socket exception: " + e . getMessage ( ) , e ) ; } catch ( IOException e ) { errorReporter . reportError ( "IO exception: " + e . getMessage ( ) , e ) ; } } return null ; }
Create a GelfSender based on the configuration.

@param senderConfiguration the configuration
@return a new {@link GelfSender} instance