static PrintWriter createPrintWriter(PrintStream printStream) {
        return new PrintWriter(new OutputStreamWriter(printStream, StandardCharsets.UTF_8));
    }
@Test
    @SetSystemProperty(key = "hazelcast.logging.type", value = "log4j2")
    @SetSystemProperty(key = "log4j2.configurationFile", value = "faulty-log.properties")
    void test_log4j2_exception() throws Exception {
        try (ByteArrayOutputStream outputStreamCaptor = new ByteArrayOutputStream();
             PrintStream errorPrintStream = new PrintStream(outputStreamCaptor)) {
            CommandLine cmd = new CommandLine(new HazelcastServerCommandLine())
                    .setOut(createPrintWriter(System.out)).setErr(createPrintWriter(errorPrintStream))
                    .setTrimQuotes(true).setExecutionExceptionHandler(new ExceptionHandler());
            cmd.execute("start");

            String string = outputStreamCaptor.toString(StandardCharsets.UTF_8);
            assertThat(string).contains("org.apache.logging.log4j.core.config.ConfigurationException: "
                    + "No type attribute provided for Layout on Appender STDOUT");
        }
    }