本文整理匯總了Java中ch.qos.logback.classic.spi.ILoggingEvent.getFormattedMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java ILoggingEvent.getFormattedMessage方法的具體用法?Java ILoggingEvent.getFormattedMessage怎麽用?Java ILoggingEvent.getFormattedMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ch.qos.logback.classic.spi.ILoggingEvent
的用法示例。
在下文中一共展示了ILoggingEvent.getFormattedMessage方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: append
import ch.qos.logback.classic.spi.ILoggingEvent; //導入方法依賴的package包/類
@Override
protected void append(ILoggingEvent event) {
LogOutput target = tlTtarget.get();
if (target == null) {
defaultAppender.doAppend(event);
return;
}
String msg;
if (event.getThrowableProxy() == null) {
msg = event.getFormattedMessage();
} else {
ExtendedThrowableProxyConverter throwableConverter = new ExtendedThrowableProxyConverter();
throwableConverter.start();
msg = event.getFormattedMessage() + "\n" + throwableConverter.convert(event);
throwableConverter.stop();
}
target.log(msg, translate(event.getLevel()));
}
示例2: convert
import ch.qos.logback.classic.spi.ILoggingEvent; //導入方法依賴的package包/類
@Override
public String convert (ILoggingEvent event) {
val key = event.getMessage();
if (!BUNDLE.containsKey(key)) {
return event.getFormattedMessage();
}
val messagePattern = BUNDLE.getString(key);
val argumentArray = event.getArgumentArray();
return MessageFormatter
.arrayFormat(messagePattern, argumentArray)
.getMessage();
}
示例3: convert
import ch.qos.logback.classic.spi.ILoggingEvent; //導入方法依賴的package包/類
public String convert(ILoggingEvent event) {
String message = event.getFormattedMessage();
return message.replaceAll(" ", Constants.SYMBOL_SPACE);
}
示例4: append
import ch.qos.logback.classic.spi.ILoggingEvent; //導入方法依賴的package包/類
@Override
protected void append(ILoggingEvent event) {
if(!("info".equalsIgnoreCase(event.getLevel().toString()) || "error".equalsIgnoreCase(event.getLevel().toString())) )
return;
// TODO Auto-generated method stub
org.apache.log4j.spi.LoggingEvent a;
List<LogItem> logItems = new ArrayList<LogItem>();
LogItem item = new LogItem();
logItems.add(item);
item.SetTime((int) (event.getTimeStamp() / 1000));
item.PushBack("time", formatter.format(new Date(event.getTimeStamp())));
item.PushBack("level", event.getLevel().toString());
item.PushBack("thread", event.getThreadName());
item.PushBack("location", event.getLoggerName());
item.PushBack("user", "登錄用戶");
item.PushBack("ip", "登錄用戶");
StringBuilder sbuf = new StringBuilder(event.getFormattedMessage());
if (event.getThrowableProxy() != null) {
throwableRenderer.render(sbuf, event);
}
Map properties = event.getMDCPropertyMap();
if (properties.size() > 0) {
Object[] keys = properties.keySet().toArray();
Arrays.sort(keys);
for (int i = 0; i < keys.length; i++) {
item.PushBack(keys[i].toString(), properties.get(keys[i]).toString());
}
}
item.PushBack("message", sbuf.toString());
producer.send(projectConfig.projectName, logstore, topic, null, logItems);
}