Source:
public void runCliScript(ModelControllerClient client, File file) { LOGGER.info("Executing CLI Script invoker for file " + file); String log = WildFlySecurityManager.getPropertyPrivileged("org.wildfly.internal.cli.boot.hook.script.logging", "false"); final LogManager logManager = LogManager.getLogManager(); if (!Boolean.parseBoolean(log)) { if (logManager instanceof org.jboss.logmanager.LogManager) { org.jboss.logmanager.LogManager jbossLogManager = (org.jboss.logmanager.LogManager) logManager; jbossLogManager.getLogger(CommandContext.class.getName()).setLevel(Level.OFF); } } CommandContext ctx = null; String props = WildFlySecurityManager.getPropertyPrivileged("org.wildfly.internal.cli.boot.hook.script.properties", null); if (props != null) { File propsFile = new File(props); if (!propsFile.exists()) { throw new RuntimeException("Could not find file " + propsFile.getAbsolutePath()); } handleProperties(propsFile); } File logFile = null; String logFilePath = WildFlySecurityManager.getPropertyPrivileged("org.wildfly.internal.cli.boot.hook.script.output.file", null); if (logFilePath != null) { logFile = new File(logFilePath); } try { OutputStream output = null; if (logFile != null) { output = new FileOutputStream(logFile); } ctx = new CommandContextImpl(output); ctx.bindClient(client); processFile(file, ctx); } catch (Exception ex) { try { LOGGER.error("Error applying " + file + " CLI script:"); for (String line : Files.readAllLines(file.toPath())) { LOGGER.error(line); } if (logFile != null) { LOGGER.error("CLI execution output:"); for (String line : Files.readAllLines(logFile.toPath())) { LOGGER.error(line); } } } catch (IOException ex1) { RuntimeException rtex = new RuntimeException(ex1); rtex.addSuppressed(ex); throw rtex; } throw new RuntimeException(ex); } finally { if (ctx != null) { ctx.terminateSession(); } clearProperties(); } LOGGER.info("Done executing CLI Script invoker for file " + file); }

Target:
public void runCliScript(ModelControllerClient client, File file) { ROOT_LOGGER.processScript(file); String log = WildFlySecurityManager.getPropertyPrivileged("org.wildfly.internal.cli.boot.hook.script.logging", "false"); final LogManager logManager = LogManager.getLogManager(); if (!Boolean.parseBoolean(log)) { if (logManager instanceof org.jboss.logmanager.LogManager) { org.jboss.logmanager.LogManager jbossLogManager = (org.jboss.logmanager.LogManager) logManager; jbossLogManager.getLogger(CommandContext.class.getName()).setLevel(Level.OFF); } } CommandContext ctx = null; String props = WildFlySecurityManager.getPropertyPrivileged("org.wildfly.internal.cli.boot.hook.script.properties", null); if (props != null) { File propsFile = new File(props); if (!propsFile.exists()) { throw ROOT_LOGGER.propertiesFileNotFound(propsFile); } handleProperties(propsFile); } File logFile = null; String logFilePath = WildFlySecurityManager.getPropertyPrivileged("org.wildfly.internal.cli.boot.hook.script.output.file", null); if (logFilePath != null) { logFile = new File(logFilePath); } try { OutputStream output = null; if (logFile != null) { output = new FileOutputStream(logFile); } ctx = new CommandContextImpl(output); ctx.bindClient(client); processFile(file, ctx); } catch (Exception ex) { try { ROOT_LOGGER.errorProcessingScript(file); StringBuilder errBuilder = new StringBuilder(); for (String line : Files.readAllLines(file.toPath())) { errBuilder.append(line).append("\n"); } ROOT_LOGGER.error(errBuilder.toString()); if (logFile != null) { ROOT_LOGGER.cliOutput(); StringBuilder logBuilder = new StringBuilder(); for (String line : Files.readAllLines(logFile.toPath())) { logBuilder.append(line).append("\n"); } ROOT_LOGGER.error(logBuilder.toString()); } } catch (IOException ex1) { RuntimeException rtex = new RuntimeException(ex1); rtex.addSuppressed(ex); throw rtex; } throw new RuntimeException(ex); } finally { if (ctx != null) { ctx.terminateSession(); } clearProperties(); } ROOT_LOGGER.doneProcessScript(file); }