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