public LoggerContext configure() {
    LoggerContext ctx = helper.getRootContext();
    ctx.reset();

    helper.enableJulChangePropagation(ctx);

    configureConsole(ctx);
    configureWithLogbackWritingToFile(ctx);

    helper.apply(
      LogLevelConfig.newBuilder(helper.getRootLoggerName())
        .rootLevelFor(ProcessId.APP)
        .immutableLevel("com.hazelcast",
          Level.toLevel("WARN"))
        .build(),
      appSettings.getProps());

    return ctx;
  }
@Test
  public void root_logger_writes_to_console_with_formatting_and_to_sonar_log_file_when_running_from_command_line() {
    emulateRunFromCommandLine(false);

    LoggerContext ctx = underTest.configure();

    Logger rootLogger = ctx.getLogger(ROOT_LOGGER_NAME);
    verifyAppConsoleAppender(rootLogger.getAppender("APP_CONSOLE"));
    verifySonarLogFileAppender(rootLogger.getAppender("file_sonar"));
    assertThat(rootLogger.iteratorForAppenders()).toIterable().hasSize(2);

    // verify no other logger except startup logger writes to sonar.log
    ctx.getLoggerList()
      .stream()
      .filter(logger -> !ROOT_LOGGER_NAME.equals(logger.getName()) && !LOGGER_STARTUP.equals(logger.getName()))
      .forEach(AppLoggingTest::verifyNoFileAppender);
  }