use of org.jboss.logmanager.ExtLogRecord in project quarkus-logging-logback by quarkiverse.
the class LogbackRecorder method createHandler.
public RuntimeValue<Optional<Handler>> createHandler() {
started = true;
for (DelayedStart i : DELAYED_START_HANDLERS) {
i.doQuarkusDelayedStart();
}
DELAYED_START_HANDLERS.clear();
return new RuntimeValue<>(Optional.of(new ExtHandler() {
@Override
public final void doPublish(final ExtLogRecord record) {
if (defaultLoggerContext == null) {
return;
}
Logger logger = defaultLoggerContext.getLogger(record.getLoggerName());
logger.callAppenders(new LoggingEventWrapper(record, getFormatter()));
}
@Override
public void flush() {
}
@Override
public void close() throws SecurityException {
}
}));
}
use of org.jboss.logmanager.ExtLogRecord in project wildfly-core by wildfly.
the class SyslogAuditLogHandler method writeLogItem.
@Override
void writeLogItem(String formattedItem) throws IOException {
boolean reconnect = isReconnect();
if (!reconnect) {
handler.publish(new ExtLogRecord(Level.WARN, formattedItem, SyslogAuditLogHandler.class.getName()));
errorManager.getAndThrowError();
} else {
ControllerLogger.MGMT_OP_LOGGER.attemptingReconnectToSyslog(name, reconnectTimeout);
try {
// establish a new connection
if (!connected) {
stop();
initialize();
}
handler.publish(new ExtLogRecord(Level.WARN, formattedItem, SyslogAuditLogHandler.class.getName()));
errorManager.getAndThrowError();
lastErrorTime = -1;
} catch (Exception e) {
// A failure has occurred and initialization should be reattempted
connected = false;
lastErrorTime = System.currentTimeMillis();
errorManager.throwAsIoOrRuntimeException(e);
}
}
}
Aggregations