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


Java MessageFormat类代码示例

本文整理汇总了Java中com.cloudbees.syslog.MessageFormat的典型用法代码示例。如果您正苦于以下问题:Java MessageFormat类的具体用法?Java MessageFormat怎么用?Java MessageFormat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: send2

import com.cloudbees.syslog.MessageFormat; //导入依赖的package包/类
@Ignore
@Test
public void send2() throws Exception {

    SyslogMessage msg = new SyslogMessage()
            .withAppName("my-app")
            .withFacility(Facility.USER)
            .withHostname("my-hostname")
            .withMsg("my message over tcp éèà " + new Timestamp(System.currentTimeMillis()))
            .withSeverity(Severity.INFORMATIONAL)
            .withTimestamp(System.currentTimeMillis());

    TcpSyslogMessageSender messageSender = new TcpSyslogMessageSender();
    messageSender.setSyslogServerHostname("logs2.papertrailapp.com");
    messageSender.setSyslogServerPort(46022);
    messageSender.setMessageFormat(MessageFormat.RFC_3164);
    messageSender.setSsl(true);

    System.out.println(msg.toSyslogMessage(messageSender.getMessageFormat()));

    messageSender.sendMessage(msg);
}
 
开发者ID:CloudBees-community,项目名称:syslog-java-client,代码行数:23,代码来源:TcpSyslogMessageSenderTest.java

示例2: sendOverSSL

import com.cloudbees.syslog.MessageFormat; //导入依赖的package包/类
@Ignore
@Test
public void sendOverSSL() throws Exception {

    SyslogMessage msg = new SyslogMessage()
            .withAppName("my-app")
            .withFacility(Facility.USER)
            .withHostname("my-hostname")
            .withMsg("my message over tcp ssl éèà " + new Timestamp(System.currentTimeMillis()))
            .withSeverity(Severity.INFORMATIONAL)
            .withTimestamp(System.currentTimeMillis());

    TcpSyslogMessageSender messageSender = new TcpSyslogMessageSender();
    messageSender.setSyslogServerHostname("logs2.papertrailapp.com");
    messageSender.setSyslogServerPort(46022);
    messageSender.setMessageFormat(MessageFormat.RFC_3164);
    messageSender.setSsl(true);

    System.out.println(msg.toSyslogMessage(messageSender.getMessageFormat()));

    messageSender.sendMessage(msg);
}
 
开发者ID:CloudBees-community,项目名称:syslog-java-client,代码行数:23,代码来源:TcpSyslogMessageSenderTest.java

示例3: send

import com.cloudbees.syslog.MessageFormat; //导入依赖的package包/类
@Test
public void send() throws Exception {
    TcpSyslogMessageSender messageSender = new TcpSyslogMessageSender();
    messageSender.setDefaultMessageHostname("mysecretkey");
    messageSender.setDefaultAppName("myapp");
    messageSender.setDefaultFacility(Facility.USER);
    messageSender.setDefaultSeverity(Severity.INFORMATIONAL);
    messageSender.setSyslogServerHostname("logs2.papertrailapp.com");
    messageSender.setSyslogServerPort(46022);
    messageSender.setMessageFormat(MessageFormat.RFC_3164);
    messageSender.setSsl(true);
    messageSender.sendMessage("unit test message over tcp éèà " + getClass() + " - " + new Timestamp(System.currentTimeMillis()));
}
 
开发者ID:CloudBees-community,项目名称:syslog-java-client,代码行数:14,代码来源:TcpSyslogMessageSenderTest.java


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