How to force logback to flush logs from a single logger tied to AsyncAppender

Viewed 96

In SpringBoot, I am using Logback's AsyncAppender to output logs asynchronously. I would like to know how to force a flush from a single logger that tied to AsyncAppender. I know that I can flush all the loggers with the following code.

LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
loggerContext.stop();

For a single logger, is there any way to flush the log queued by AsyncAppender like LoggerFactory.getLogger().flush?

0 Answers
Related