From 5de97a39a0338fca4d917dbfc6d7fd7a1535a9c8 Mon Sep 17 00:00:00 2001 From: jbertram Date: Thu, 17 Sep 2015 15:21:15 -0500 Subject: [PATCH] ARTEMIS-224 add logmanager to JVM args --- .../activemq/artemis/cli/commands/Create.java | 20 +++++++++++++++++++ .../artemis/cli/commands/etc/artemis.profile | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java index 8a2d60e00f..0a430a3b25 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java @@ -21,6 +21,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; +import java.io.FilenameFilter; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -526,6 +527,8 @@ public class Create extends InputAbstract { File dataFolder = new File(directory, "data"); dataFolder.mkdirs(); + filters.put("${logmanager}", getLogManager()); + if (javaOptions == null || javaOptions.length() == 0) { javaOptions = ""; } @@ -616,6 +619,23 @@ public class Create extends InputAbstract { return null; } + private String getLogManager() throws IOException { + String logManager = ""; + File dir = new File(path(getHome().toString(), false) + "/lib"); + + File[] matches = dir.listFiles(new FilenameFilter() { + public boolean accept(File dir, String name) { + return name.startsWith("jboss-logmanager") && name.endsWith(".jar"); + } + }); + + if (matches != null && matches.length > 0) { + logManager = matches[0].getName(); + } + + return logManager; + } + /** * It will create the jms configurations */ diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile index ff3164282a..2a51e2adba 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/artemis.profile @@ -23,7 +23,7 @@ ARTEMIS_HOME='${artemis.home}' # Java Opts -JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M ${java-opts}" +JAVA_ARGS="-XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Xbootclasspath/a:$ARTEMIS_HOME/lib/${logmanager} -Djava.util.logging.manager=org.jboss.logmanager.LogManager ${java-opts}" # Debug args: Uncomment to enable debug