org.apache.logging.log4j.core.Layout.encode()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(1.2k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中org.apache.logging.log4j.core.Layout.encode()方法的一些代码示例,展示了Layout.encode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Layout.encode()方法的具体详情如下:
包路径:org.apache.logging.log4j.core.Layout
类名称:Layout
方法名:encode

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();
  }
}

相关文章