当前位置: 首页>>代码示例>>Java>>正文


Java GelfTransports.create方法代码示例

本文整理汇总了Java中org.graylog2.gelfclient.GelfTransports.create方法的典型用法代码示例。如果您正苦于以下问题:Java GelfTransports.create方法的具体用法?Java GelfTransports.create怎么用?Java GelfTransports.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.graylog2.gelfclient.GelfTransports的用法示例。


在下文中一共展示了GelfTransports.create方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import org.graylog2.gelfclient.GelfTransports; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void init(Configuration configuration) throws Exception {
    final InetSocketAddress remoteAddress = new InetSocketAddress(server, port);
    final GelfConfiguration gelfConfiguration = new GelfConfiguration(remoteAddress)
            .transport(transport)
            .queueSize(queueSize)
            .connectTimeout(connectTimeout)
            .reconnectDelay(reconnectDelay)
            .sendBufferSize(sendBufferSize)
            .tcpNoDelay(tcpNoDelay);

    client = GelfTransports.create(gelfConfiguration);

    VMShutdownHook.register(this);
}
 
开发者ID:joschi,项目名称:tinylog-gelf,代码行数:19,代码来源:GelfWriter.java

示例2: doStart

import org.graylog2.gelfclient.GelfTransports; //导入方法依赖的package包/类
@Override
protected void doStart() {
    final GelfConfiguration clientConfig = new GelfConfiguration(configuration.getHost(), configuration.getPort());

    switch (configuration.getProtocol()) {
        case UDP:
            clientConfig
                    .transport(GelfTransports.UDP)
                    .queueSize(configuration.getClientQueueSize())
                    .sendBufferSize(configuration.getClientSendBufferSize());
        case TCP:
            clientConfig
                    .transport(GelfTransports.TCP)
                    .queueSize(configuration.getClientQueueSize())
                    .connectTimeout(configuration.getClientConnectTimeout())
                    .reconnectDelay(configuration.getClientReconnectDelay())
                    .tcpNoDelay(configuration.isClientTcpNoDelay())
                    .sendBufferSize(configuration.getClientSendBufferSize());

            if (configuration.isClientTls()) {
                clientConfig.enableTls();
                clientConfig.tlsTrustCertChainFile(configuration.getClientTlsCertChainFile());

                if (configuration.isClientTlsVerifyCert()) {
                    clientConfig.enableTlsCertVerification();
                } else {
                    clientConfig.disableTlsCertVerification();
                }
            }
            break;
    }

    LOG.info("Starting GELF transport: {}", clientConfig);
    this.transport = GelfTransports.create(clientConfig);

    transportInitialized.countDown();

    notifyStarted();
}
 
开发者ID:DevOpsStudio,项目名称:Re-Collector,代码行数:40,代码来源:GelfOutput.java

示例3: Graylog2Impl

import org.graylog2.gelfclient.GelfTransports; //导入方法依赖的package包/类
@Inject
public Graylog2Impl(Configuration config) {
    String canonicalHostName;
    try {
        canonicalHostName = config.getString(
                "graylog2.appender.sourcehost",
                InetAddress.getLocalHost().getCanonicalHostName()
        );
    } catch (UnknownHostException e) {
        canonicalHostName = "unknown";
    }

    accessLogEnabled = config.getBoolean("graylog2.appender.access-log", false);

    final GelfConfiguration gelfConfiguration = getGelfConfiguration(config);

    GelfTransport transport = GelfTransports.create(gelfConfiguration);

    final LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
    final Logger rootLogger = lc.getLogger(Logger.ROOT_LOGGER_NAME);

    gelfClientAppender = new GelfClientAppender(transport, canonicalHostName);

    gelfClientAppender.setContext(lc);

    gelfClientAppender.start();

    rootLogger.addAppender(gelfClientAppender);
}
 
开发者ID:tochkak,项目名称:play-graylog2,代码行数:30,代码来源:Graylog2Component.java

示例4: GraylogUplink

import org.graylog2.gelfclient.GelfTransports; //导入方法依赖的package包/类
public GraylogUplink(String hostname, int port, String nzymeId, String networkInterfaceName) {
    this.nzymeId = nzymeId;
    this.networkInterfaceName = networkInterfaceName;

    this.gelfTransport = GelfTransports.create(new GelfConfiguration(new InetSocketAddress(hostname, port))
            .transport(GelfTransports.TCP)
            .queueSize(512)
            .connectTimeout(5000)
            .reconnectDelay(1000)
            .tcpNoDelay(true)
            .sendBufferSize(32768));
}
 
开发者ID:lennartkoopmann,项目名称:nzyme,代码行数:13,代码来源:GraylogUplink.java

示例5: Graylog2Plugin

import org.graylog2.gelfclient.GelfTransports; //导入方法依赖的package包/类
public Graylog2Plugin(Application app) {
    final Configuration config = app.configuration();

    accessLogEnabled = config.getBoolean("graylog2.appender.send-access-log", false);
    queueCapacity = config.getInt("graylog2.appender.queue-size", 512);
    reconnectInterval = config.getMilliseconds("graylog2.appender.reconnect-interval", 500L);
    connectTimeout = config.getMilliseconds("graylog2.appender.connect-timeout", 1000L);
    isTcpNoDelay = config.getBoolean("graylog2.appender.tcp-nodelay", false);
    sendBufferSize = config.getInt("graylog2.appender.sendbuffersize", 0); // causes the socket default to be used
    try {
        canonicalHostName = config.getString("graylog2.appender.sourcehost", InetAddress.getLocalHost().getCanonicalHostName());
    } catch (UnknownHostException e) {
        canonicalHostName = "localhost";
        log.error("Unable to resolve canonical localhost name. " +
                "Please set it manually via graylog2.appender.sourcehost or fix your lookup service, falling back to {}", canonicalHostName);
    }
    // TODO make this a list and dynamically accessible from the application
    final String hostString = config.getString("graylog2.appender.host", "127.0.0.1:12201");
    final String protocol = config.getString("graylog2.appender.protocol", "tcp");

    final HostAndPort hostAndPort = HostAndPort.fromString(hostString);

    final GelfTransports gelfTransport = GelfTransports.valueOf(protocol.toUpperCase());

    final GelfConfiguration gelfConfiguration = new GelfConfiguration(hostAndPort.getHostText(), hostAndPort.getPort())
            .transport(gelfTransport)
            .reconnectDelay(reconnectInterval.intValue())
            .queueSize(queueCapacity)
            .connectTimeout(connectTimeout.intValue())
            .tcpNoDelay(isTcpNoDelay)
            .sendBufferSize(sendBufferSize);

    this.transport = GelfTransports.create(gelfConfiguration);

    final LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
    rootLogger = lc.getLogger(Logger.ROOT_LOGGER_NAME);

    gelfAppender = new GelfclientAppender(transport, getLocalHostName());
    gelfAppender.setContext(lc);
}
 
开发者ID:graylog-labs,项目名称:play2-graylog2,代码行数:41,代码来源:Graylog2Plugin.java

示例6: start

import org.graylog2.gelfclient.GelfTransports; //导入方法依赖的package包/类
@Override
public void start() {
    super.start();
    client = GelfTransports.create(gelfConfiguration);
}
 
开发者ID:graylog-labs,项目名称:log4j2-gelf,代码行数:6,代码来源:GelfAppender.java

示例7: createGelfClient

import org.graylog2.gelfclient.GelfTransports; //导入方法依赖的package包/类
private void createGelfClient() {

        client = GelfTransports.create(getGelfConfiguration());
    }
 
开发者ID:rkcpi,项目名称:logback-gelf-appender,代码行数:5,代码来源:GelfAppender.java


注:本文中的org.graylog2.gelfclient.GelfTransports.create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。