Search in sources :

Example 1 with ExtHandler

use of org.jboss.logmanager.ExtHandler 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 {
        }
    }));
}
Also used : ExtHandler(org.jboss.logmanager.ExtHandler) ExtLogRecord(org.jboss.logmanager.ExtLogRecord) RuntimeValue(io.quarkus.runtime.RuntimeValue) Logger(ch.qos.logback.classic.Logger)

Aggregations

Logger (ch.qos.logback.classic.Logger)1 RuntimeValue (io.quarkus.runtime.RuntimeValue)1 ExtHandler (org.jboss.logmanager.ExtHandler)1 ExtLogRecord (org.jboss.logmanager.ExtLogRecord)1