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


Java Priority类代码示例

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


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

示例1: toSerializable

import org.apache.logging.log4j.core.net.Priority; //导入依赖的package包/类
/**
 * Formats a {@link org.apache.logging.log4j.core.LogEvent} in conformance with the BSD Log record format.
 *
 * @param event The LogEvent
 * @return the event formatted as a String.
 */
@Override
public String toSerializable(final LogEvent event) {
    final StringBuilder buf = new StringBuilder();

    buf.append("<");
    buf.append(Priority.getPriority(facility, event.getLevel()));
    buf.append(">");
    addDate(event.getMillis(), buf);
    buf.append(" ");
    buf.append(localHostname);
    buf.append(" ");

    String message = event.getMessage().getFormattedMessage();
    if (null != escapeNewLine) {
        message = NEWLINE_PATTERN.matcher(message).replaceAll(escapeNewLine);
    }
    buf.append(message);

    if (includeNewLine) {
        buf.append("\n");
    }
    return buf.toString();
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:30,代码来源:SyslogLayout.java

示例2: toSerializable

import org.apache.logging.log4j.core.net.Priority; //导入依赖的package包/类
/**
 * Formats a {@link org.apache.logging.log4j.core.LogEvent} in conformance with the BSD Log record format.
 *
 * @param event The LogEvent
 * @return the event formatted as a String.
 */
@Override
public String toSerializable(final LogEvent event) {
    final StringBuilder buf = getStringBuilder();

    buf.append('<');
    buf.append(Priority.getPriority(facility, event.getLevel()));
    buf.append('>');
    addDate(event.getTimeMillis(), buf);
    buf.append(Chars.SPACE);
    buf.append(localHostname);
    buf.append(Chars.SPACE);

    String message = event.getMessage().getFormattedMessage();
    if (null != escapeNewLine) {
        message = NEWLINE_PATTERN.matcher(message).replaceAll(escapeNewLine);
    }
    buf.append(message);

    if (includeNewLine) {
        buf.append('\n');
    }
    return buf.toString();
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:30,代码来源:SyslogLayout.java

示例3: checkTheEqualityOfSentAndReceivedMessages

import org.apache.logging.log4j.core.net.Priority; //导入依赖的package包/类
protected void checkTheEqualityOfSentAndReceivedMessages(final Level expectedLevel) throws InterruptedException {
    final List<String> receivedMessages = getReceivedMessages(DEFAULT_TIMEOUT_IN_MS);

    assertNotNull("No messages received", receivedMessages);
    for (int i = 0; i < receivedMessages.size(); i++) {
        final String receivedMessage = receivedMessages.get(i);
        final String sentMessage = sentMessages.get(i);
        final String suffix = includeNewLine ? "\n" : Strings.EMPTY;
        assertTrue("Incorrect message received: " + receivedMessage,
                receivedMessage.endsWith(sentMessage + suffix) || receivedMessage.contains(sentMessage));
        final int expectedPriority = Priority.getPriority(getExpectedFacility(), expectedLevel);
        assertTrue("Expected facility " + expectedPriority + " in message " + receivedMessage,
                receivedMessage.startsWith("<" + expectedPriority + ">"));
    }
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:16,代码来源:SyslogAppenderTestBase.java

示例4: appendPriority

import org.apache.logging.log4j.core.net.Priority; //导入依赖的package包/类
private void appendPriority(final StringBuilder buffer, final Level logLevel) {
    buffer.append("<");
    buffer.append(Priority.getPriority(facility, logLevel));
    buffer.append(">1 ");
}
 
开发者ID:OuZhencong,项目名称:log4j2,代码行数:6,代码来源:RFC5424Layout.java

示例5: appendPriority

import org.apache.logging.log4j.core.net.Priority; //导入依赖的package包/类
private void appendPriority(final StringBuilder buffer, final Level logLevel) {
    buffer.append('<');
    buffer.append(Priority.getPriority(facility, logLevel));
    buffer.append(">1 ");
}
 
开发者ID:apache,项目名称:logging-log4j2,代码行数:6,代码来源:Rfc5424Layout.java


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