code: public static void addToRootLogger(
        Registry registry,
        String name,
        boolean ignoreExceptions) {
      final Appender appender = new SpectatorAppender(registry, name, null, null, ignoreExceptions);
      appender.start();
  
      LoggerContext context = (LoggerContext) LogManager.getContext(false);
      Configuration config = context.getConfiguration();
  
      addToRootLogger(appender);
      config.addListener(reconfigurable -> addToRootLogger(appender));
    }
docs: Add the spectator appender to the root logger. This method is intended to be called once
  as part of the applications initialization process.
  
  @param registry
  Spectator registry to use for the appender.
  @param name
  Name for the appender.
  @param ignoreExceptions
  If set to true then the stack trace metrics are disabled.