private void drainLogsForever(MpscUnboundedArrayQueue<LogRecord> recordQueue) {
        BackoffIdleStrategy idleStrategy = new BackoffIdleStrategy(128, 128, 1024000, 1024000);
        LogRecord logRecord;
        while (true) {
            while ((logRecord = recordQueue.relaxedPoll()) != null) {
                idleStrategy.reset();
                List<Appender> appenders = logRecord.logger()
                        .getAppenders();
                for (Appender appender : appenders) {
                    try {
                        appender.append(logRecord);
                    } catch (Exception e) {
                        InternalLogger.INSTANCE
                                .error("Caught an error while appending the log record: "
                                        + logRecord, e);
                    }
                }
                ReferenceCountUtil.safeEnsureReleased(logRecord.data());
            }
            if (!active) {
                break;
            }
            idleStrategy.idle();
            // Don't check if it is active here so that we can have
            // the last chance to output remaining logs after waking up.
        }
        for (Appender appender : LoggerFactory.getAllAppenders()) {
            try {
                appender.close();
            } catch (Exception e) {
                InternalLogger.INSTANCE.error("Caught an error while closing the appender: "
                        + appender, e);
            }
        }
    }
Note that we only use one thread to process logs, which means that we don't need to consider the
scenarios of concurrent modifications

@author James Chen
turms-server-common/src/main/java/im/turms/server/common/infra/logging/core/processor/LogProcessor.java