當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。