本文整理汇总了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);
}
示例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);
}
示例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()));
}