org.slf4j.event.LoggingEvent Java Examples
The following examples show how to use
org.slf4j.event.LoggingEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JDK14LoggerAdapter.java From HttpSessionReplacer with MIT License | 6 votes |
private LogRecord eventToRecord(LoggingEvent event, Level julLevel) { String format = event.getMessage(); Object[] arguments = event.getArgumentArray(); FormattingTuple ft = MessageFormatter.arrayFormat(format, arguments); if (ft.getThrowable() != null && event.getThrowable() != null) { throw new IllegalArgumentException("both last element in argument array and last argument are of type Throwable"); } Throwable t = event.getThrowable(); if (ft.getThrowable() != null) { t = ft.getThrowable(); throw new IllegalStateException("fix above code"); } LogRecord record = new LogRecord(julLevel, ft.getMessage()); record.setLoggerName(event.getLoggerName()); record.setMillis(event.getTimeStamp()); record.setSourceClassName(EventConstants.NA_SUBST); record.setSourceMethodName(EventConstants.NA_SUBST); record.setThrown(t); return record; }
Example #2
Source File: JDK14LoggerAdapter.java From HttpSessionReplacer with MIT License | 5 votes |
/** * @param event * @since 1.7.15 */ public void log(LoggingEvent event) { Level julLevel = slf4jLevelIntToJULLevel(event.getLevel().toInt()); if (logger.isLoggable(julLevel)) { LogRecord record = eventToRecord(event, julLevel); logger.log(record); } }
Example #3
Source File: DubboAppender.java From dubbo3 with Apache License 2.0 | 5 votes |
public void append(LoggingEvent event) { super.append(event); if (available) { Log temp = parseLog(event); logList.add(temp); } }
Example #4
Source File: DubboAppender.java From dubbo3 with Apache License 2.0 | 5 votes |
private Log parseLog(LoggingEvent event) { Log log = new Log(); log.setLogName(event.getLoggerName()); log.setLogLevel(event.getLevel()); log.setLogThread(event.getThreadName()); log.setLogMessage(event.getMessage()); return log; }
Example #5
Source File: TestAppender.java From JVoiceXML with GNU Lesser General Public License v2.1 | 5 votes |
/** * {@inheritDoc} */ public void doAppend(final LoggingEvent event) { final String message = event.toString(); if (!message.startsWith(TEST_PREFIX)) { return; } messages.add(message); }