本文整理了Java中ch.qos.logback.core.Layout.doLayout()
方法的一些代码示例,展示了Layout.doLayout()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Layout.doLayout()
方法的具体详情如下:
包路径:ch.qos.logback.core.Layout
类名称:Layout
方法名:doLayout
[英]Transform an event (of type Object) and return it as a String after appropriate formatting.
Taking in an object and returning a String is the least sophisticated way of formatting events. However, it is remarkably CPU-effective.
[中]转换事件(对象类型)并在适当的格式设置后将其作为字符串返回。
接收对象并返回字符串是格式化事件最不复杂的方式。然而,它是非常有效的CPU。
代码示例来源:origin: ch.qos.logback/logback-classic
@Override
protected void fillBuffer(CyclicBuffer<ILoggingEvent> cb, StringBuffer sbuf) {
int len = cb.length();
for (int i = 0; i < len; i++) {
ILoggingEvent event = cb.get();
sbuf.append(layout.doLayout(event));
}
}
代码示例来源:origin: signalapp/Signal-Server
@Override
protected void append(E loggingEvent) {
syslog.log(getSeverityForEvent(loggingEvent), layout.doLayout(loggingEvent));
}
代码示例来源:origin: skylot/jadx
@Override
protected void append(ILoggingEvent event) {
synchronized (this) {
Level level = event.getLevel();
String msg = layout.doLayout(event);
store(level, msg);
if (listener != null && level.isGreaterOrEqual(listener.getFilterLevel())) {
listener.onAppend(msg);
}
}
}
代码示例来源:origin: apache/rocketmq
/**
* Info,error,warn,callback method implementation
*/
@Override
protected void append(ILoggingEvent event) {
if (!isStarted()) {
return;
}
String logStr = this.layout.doLayout(event);
try {
Message msg = new Message(topic, tag, logStr.getBytes());
msg.getProperties().put(ProducerInstance.APPENDER_TYPE, ProducerInstance.LOGBACK_APPENDER);
//Send message and do not wait for the ack from the message broker.
producer.sendOneway(msg);
} catch (Exception e) {
addError("Could not send message in RocketmqLogbackAppender [" + name + "]. Message is : " + logStr, e);
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
public void doEncode(E event) throws IOException {
String txt = layout.doLayout(event);
outputStream.write(convertToBytes(txt));
if (immediateFlush)
outputStream.flush();
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
protected void fillBuffer(CyclicBuffer<ILoggingEvent> cb, StringBuffer sbuf) {
int len = cb.length();
for (int i = 0; i < len; i++) {
ILoggingEvent event = cb.get();
sbuf.append(layout.doLayout(event));
}
}
代码示例来源:origin: torakiki/pdfsam
@Override
public void append(ILoggingEvent event) {
if (!isStarted()) {
return;
}
Layout<ILoggingEvent> layout = encoder.getLayout();
if (nonNull(layout)) {
doAppendMessage(encoder.getLayout().doLayout(event), event);
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
protected void append(E eventObject) {
if (!isStarted()) {
return;
}
try {
String msg = layout.doLayout(eventObject);
if(msg == null) {
return;
}
if (msg.length() > maxMessageSize) {
msg = msg.substring(0, maxMessageSize);
}
sos.write(msg.getBytes());
sos.flush();
postProcess(eventObject, sos);
} catch (IOException ioe) {
addError("Failed to send diagram to " + syslogHost, ioe);
}
}
代码示例来源:origin: didi/DDMQ
/**
* Info,error,warn,callback method implementation
*/
@Override
protected void append(ILoggingEvent event) {
if (!isStarted()) {
return;
}
String logStr = this.layout.doLayout(event);
try {
Message msg = new Message(topic, tag, logStr.getBytes());
msg.getProperties().put(ProducerInstance.APPENDER_TYPE, ProducerInstance.LOGBACK_APPENDER);
//Send message and do not wait for the ack from the message broker.
producer.sendOneway(msg);
} catch (Exception e) {
addError("Could not send message in RocketmqLogbackAppender [" + name + "]. Message is : " + logStr, e);
}
}
代码示例来源:origin: camunda/camunda-bpm-platform
subjectStr = subjectLayout.doLayout(lastEventObject);
代码示例来源:origin: ch.qos.logback/logback-examples
@Override
protected void append(ILoggingEvent loggingEvent) {
// note that AppenderBase.doAppend will invoke this method only if
// this appender was successfully started.
String eventAsStr = this.layout.doLayout(loggingEvent);
System.out.println(eventAsStr);
}
代码示例来源:origin: ch.qos.logback/logback-examples
public void append(ILoggingEvent event) {
if (counter >= limit) {
return;
}
// output the events as formatted by patternLayout
String eventStr = this.layout.doLayout(event);
System.out.print(eventStr);
// prepare for next event
counter++;
}
代码示例来源:origin: Adobe-Consulting-Services/acs-aem-tools
public List<String> getLogs(String collectorKey) {
List<ILoggingEvent> eventList = logEvents.get(collectorKey);
if (eventList == null) {
return Collections.emptyList();
}
List<String> result = new ArrayList<String>(eventList.size());
for (ILoggingEvent e : eventList) {
result.add(layout.doLayout(e));
}
return result;
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/ch.qos.logback.core
public void doEncode(E event) throws IOException {
String txt = layout.doLayout(event);
outputStream.write(convertToBytes(txt));
if (immediateFlush)
outputStream.flush();
}
代码示例来源:origin: tony19/logback-android
public byte[] encode(E event) {
String txt = layout.doLayout(event);
return convertToBytes(txt);
}
代码示例来源:origin: tony19/logback-android
@Override
protected void fillBuffer(CyclicBuffer<ILoggingEvent> cb, StringBuffer sbuf) {
int len = cb.length();
for (int i = 0; i < len; i++) {
ILoggingEvent event = cb.get();
sbuf.append(layout.doLayout(event));
}
}
代码示例来源:origin: tony19/logback-android
@Override
protected void append(E eventObject) {
String res = layout.doLayout(eventObject);
strList.add(res);
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/ch.qos.logback.classic
@Override
protected void fillBuffer(CyclicBuffer<ILoggingEvent> cb, StringBuffer sbuf) {
int len = cb.length();
for (int i = 0; i < len; i++) {
ILoggingEvent event = cb.get();
sbuf.append(layout.doLayout(event));
}
}
代码示例来源:origin: ch.qos.logback/logback-access
@Override
protected void fillBuffer(CyclicBuffer<IAccessEvent> cb, StringBuffer sbuf) {
int len = cb.length();
for (int i = 0; i < len; i++) {
// sbuf.append(MimeUtility.encodeText(layout.format(cb.getOrCreate())));
IAccessEvent event = cb.get();
sbuf.append(layout.doLayout(event));
}
}
代码示例来源:origin: theotherp/nzbhydra2
public byte[] encode(ILoggingEvent event) {
String txt = layout.doLayout(event);
txt = removeSensitiveData(txt);
return convertToBytes(txt);
}
内容来源于网络,如有侵权,请联系作者删除!