本文整理了Java中org.apache.logging.log4j.core.Layout.toSerializable()
方法的一些代码示例,展示了Layout.toSerializable()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Layout.toSerializable()
方法的具体详情如下:
包路径:org.apache.logging.log4j.core.Layout
类名称:Layout
方法名:toSerializable
[英]Formats the event as an Object that can be serialized.
[中]将事件格式化为可序列化的对象。
代码示例来源:origin: javamelody/javamelody
/**
* {@inheritDoc}
*/
@Override
public void append(final LogEvent event) {
final Throwable throwable = event.getThrown();
final String message = getLayout().toSerializable(event).toString();
LoggingHandler.addErrorLogToCounter(message, throwable);
}
}
代码示例来源:origin: info.xiancloud/xian-gelf-common
@Override
public String getFormattedMessage() {
return layout.toSerializable(logEvent).toString();
}
代码示例来源:origin: org.infinispan/infinispan-commons-test
@Override
public void append(LogEvent event) {
if (threadFilter.test(Thread.currentThread())) {
logs.add((String) getLayout().toSerializable(event));
}
}
代码示例来源:origin: org.mycore.mir/mir-wizard
@Override
public void append(LogEvent event) {
writer.write(this.getLayout().toSerializable(event).toString());
}
代码示例来源:origin: xie19900123/spring-boot-learning
@Override
public void append(LogEvent event) {
if (event != null && event.getMessage() != null) {
// 此处自定义实现输出
// 获取输出值:event.getMessage().toString()
// System.out.print(event.getMessage().toString());
// 格式化输出
System.out.print(printString + ":" + getLayout().toSerializable(event));
}
}
代码示例来源:origin: ops4j/org.ops4j.pax.logging
@Override
public void append(final LogEvent event) {
this.manager.send(event, getLayout().toSerializable(event));
}
代码示例来源:origin: net.bull.javamelody/javamelody-core
/**
* {@inheritDoc}
*/
@Override
public void append(final LogEvent event) {
final Throwable throwable = event.getThrown();
final String message = getLayout().toSerializable(event).toString();
LoggingHandler.addErrorLogToCounter(message, throwable);
}
}
代码示例来源:origin: GoMint/GoMint
@Override
public void append(LogEvent event) {
if (terminal != null) {
if (reader != null) {
try {
// Clear, write and redraw prompt again so the prompt is always at the bottom
reader.callWidget(LineReader.CLEAR);
terminal.writer().print(getLayout().toSerializable(event));
reader.callWidget(LineReader.REDRAW_LINE);
reader.callWidget(LineReader.REDISPLAY);
} catch (Exception e) {
// There was an error (we did not really read from terminal)
terminal.writer().print(getLayout().toSerializable(event));
}
} else {
// There is no reader, no need to redraw prompt
terminal.writer().print(getLayout().toSerializable(event));
}
terminal.writer().flush();
} else {
STDOUT.print(getLayout().toSerializable(event));
}
}
代码示例来源:origin: apache/samza
private Message subAppend(LogEvent event) {
if (getLayout() == null) {
return new SimpleMessage(event.getMessage().getFormattedMessage());
} else {
Object obj = getLayout().toSerializable(event);
if (obj instanceof Message) {
return new SimpleMessage(((Message) obj).getFormattedMessage());
} else if (obj instanceof LogEvent) {
return new SimpleMessage(((LogEvent) obj).getMessage().getFormattedMessage());
} else {
return new SimpleMessage(obj.toString());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!