本文整理了Java中org.apache.logging.log4j.core.Layout.encode()
方法的一些代码示例,展示了Layout.encode()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Layout.encode()
方法的具体详情如下:
包路径:org.apache.logging.log4j.core.Layout
类名称:Layout
方法名:encode
暂无
代码示例来源:origin: org.apache.logging.log4j/log4j-core
@Override
public synchronized void append(final LogEvent event) {
final Layout<? extends Serializable> layout = getLayout();
if (layout == null) {
events.add(event);
} else if (layout instanceof SerializedLayout) {
final Destination content = new Destination();
content.byteBuffer.put(layout.getHeader());
layout.encode(event, content);
content.getByteBuffer().flip();
final byte[] record = new byte[content.getByteBuffer().remaining()];
content.getByteBuffer().get(record);
data.add(record);
} else {
final Destination content = new Destination();
layout.encode(event, content);
content.getByteBuffer().flip();
final byte[] record = new byte[content.getByteBuffer().remaining()];
content.getByteBuffer().get(record);
write(record);
}
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
protected void directEncodeEvent(final LogEvent event) {
getLayout().encode(event, manager);
if (this.immediateFlush || event.isEndOfBatch()) {
manager.flush();
}
}
内容来源于网络,如有侵权,请联系作者删除!