use of org.apache.syncope.common.lib.log.LogStatementTO in project syncope by apache.
the class MemoryAppender method append.
@Override
public void append(final LogEvent event) {
LogStatementTO statement = new LogStatementTO();
statement.setLevel(LoggerLevel.fromLevel(event.getLevel()));
statement.setLoggerName(event.getLoggerName());
Message msg = event.getMessage();
statement.setMessage((msg instanceof ReusableMessage ? ((ReusableMessage) msg).memento() : msg).getFormattedMessage());
statement.setTimeMillis(event.getTimeMillis());
if (event.getThrown() != null) {
statement.setStackTrace(ExceptionUtils2.getFullStackTrace(event.getThrown()));
}
statement.setThreadId(event.getThreadId());
statement.setThreadName(event.getThreadName());
statement.setThreadPriority(event.getThreadPriority());
this.statements.add(statement);
}
use of org.apache.syncope.common.lib.log.LogStatementTO in project syncope by apache.
the class LoggerITCase method lastStatements.
@Test
public void lastStatements() {
List<LogStatementTO> statements = loggerService.getLastLogStatements("connid");
assertNotNull(statements);
assertFalse(statements.isEmpty());
LogStatementTO statement = statements.get(0);
assertNotNull(statement);
assertNotNull(statement.getLoggerName());
assertNotNull(statement.getLevel());
assertNotNull(statement.getMessage());
assertNotNull(statement.getTimeMillis());
}
use of org.apache.syncope.common.lib.log.LogStatementTO in project syncope by apache.
the class LoggerResultManager method fromGetLastLogStatements.
public void fromGetLastLogStatements(final List<LogStatementTO> statements) throws JsonProcessingException {
final Table.TableBuilder tableBuilder = new Table.TableBuilder("last statements").header("statement");
for (final LogStatementTO statement : statements) {
tableBuilder.rowValues(Collections.singletonList(MAPPER.writerWithDefaultPrettyPrinter().writeValueAsString(statement)));
}
tableBuilder.build().print();
}
Aggregations