code: private static Appender<ILoggingEvent> getStdErrAppender(final LoggerContext context,
                                                             final ReplaceNewLines replaceNewLines) {
  
      // Setup format
      final PatternLayoutEncoder encoder = new PatternLayoutEncoder();
      encoder.setContext(context);
      encoder.setPattern(
          "%date{HH:mm:ss.SSS} %property{ident}[%property{pid}]: %-5level [%thread] %logger{0}: "
              + ReplaceNewLines.getMsgPattern(replaceNewLines) + "%n");
      encoder.setCharset(Charsets.UTF_8);
      encoder.start();
  
      // Setup stderr appender
      final ConsoleAppender<ILoggingEvent> appender = new ConsoleAppender<ILoggingEvent>();
      appender.setTarget("System.err");
      appender.setName("stderr");
      appender.setEncoder(encoder);
      appender.setContext(context);
      appender.start();
  
      return appender;
    }
docs: Create a stderr appender.
  
  @param context The logger context to use.
  @return An appender writing to stderr.