本文整理匯總了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()));
}