ARTEMIS-1150 Fixing logging with spaces

This commit is contained in:
Clebert Suconic 2017-05-05 16:00:56 -04:00
parent 0711b35e3c
commit a915e8b904
5 changed files with 31 additions and 23 deletions

View File

@ -584,12 +584,13 @@ public class Create extends InputAbstract {
applyAddressesAndQueues(filters);
if (home != null) {
filters.put("${home}", path(home, false));
filters.put("${home}", path(home));
}
filters.put("${artemis.home}", path(getHome().toString(), false));
filters.put("${artemis.instance}", path(directory, false));
filters.put("${artemis.home}", path(getHome().toString()));
filters.put("${artemis.instance}", path(directory));
filters.put("${artemis.instance.uri}", directory.toURI().toString());
filters.put("${artemis.instance.name}", directory.getName());
filters.put("${java.home}", path(System.getProperty("java.home"), false));
filters.put("${java.home}", path(System.getProperty("java.home")));
new File(directory, "bin").mkdirs();
new File(directory, "etc").mkdirs();
@ -688,7 +689,7 @@ public class Create extends InputAbstract {
context.out.println("");
context.out.println("You can now start the broker by executing: ");
context.out.println("");
context.out.println(String.format(" \"%s\" run", path(new File(directory, "bin/artemis"), true)));
context.out.println(String.format(" \"%s\" run", path(new File(directory, "bin/artemis"))));
File service = new File(directory, BIN_ARTEMIS_SERVICE);
context.out.println("");
@ -696,7 +697,7 @@ public class Create extends InputAbstract {
if (!IS_WINDOWS || IS_CYGWIN) {
context.out.println("Or you can run the broker in the background using:");
context.out.println("");
context.out.println(String.format(" \"%s\" start", path(service, true)));
context.out.println(String.format(" \"%s\" start", path(service)));
context.out.println("");
}
@ -704,14 +705,14 @@ public class Create extends InputAbstract {
service = new File(directory, BIN_ARTEMIS_SERVICE_EXE);
context.out.println("Or you can setup the broker as Windows service and run it in the background:");
context.out.println("");
context.out.println(String.format(" \"%s\" install", path(service, true)));
context.out.println(String.format(" \"%s\" start", path(service, true)));
context.out.println(String.format(" \"%s\" install", path(service)));
context.out.println(String.format(" \"%s\" start", path(service)));
context.out.println("");
context.out.println(" To stop the windows service:");
context.out.println(String.format(" \"%s\" stop", path(service, true)));
context.out.println(String.format(" \"%s\" stop", path(service)));
context.out.println("");
context.out.println(" To uninstall the windows service");
context.out.println(String.format(" \"%s\" uninstall", path(service, true)));
context.out.println(String.format(" \"%s\" uninstall", path(service)));
}
return null;
@ -752,7 +753,7 @@ public class Create extends InputAbstract {
private String getLogManager() throws IOException {
String logManager = "";
File dir = new File(path(getHome().toString(), false) + "/lib");
File dir = new File(path(getHome().toString()) + "/lib");
File[] matches = dir.listFiles(new FilenameFilter() {
@Override
@ -866,16 +867,12 @@ public class Create extends InputAbstract {
}
}
private String path(String value, boolean unixPaths) throws IOException {
return path(new File(value), unixPaths);
private String path(String value) throws IOException {
return path(new File(value));
}
private String path(File value, boolean unixPaths) throws IOException {
if (unixPaths && IS_CYGWIN) {
return value.getCanonicalPath();
} else {
return value.getCanonicalPath();
}
private String path(File value) throws IOException {
return value.getCanonicalPath();
}
private void write(String source, HashMap<String, String> filters, boolean unixTarget) throws Exception {

View File

@ -44,13 +44,14 @@ if [ -z "$ARTEMIS_INSTANCE" ] ; then
ARTEMIS_INSTANCE=`cd "$ARTEMIS_INSTANCE/.." && pwd`
fi
# Load Profile Data
. "$ARTEMIS_INSTANCE/etc/artemis.profile"
# Set Defaults Properties
ARTEMIS_LOGGING_CONF="file:$ARTEMIS_INSTANCE/etc/logging.properties"
ARTEMIS_LOGGING_CONF="$ARTEMIS_INSTANCE_URI/etc/logging.properties"
ARTEMIS_DATA_DIR="$ARTEMIS_INSTANCE/data"
ARTEMIS_LOG_MANAGER=org.jboss.logmanager.LogManager
# Load Profile Data
. "$ARTEMIS_INSTANCE/etc/artemis.profile"
CLASSPATH="$ARTEMIS_HOME/lib/artemis-boot.jar"

View File

@ -48,7 +48,7 @@ echo.
:RUN_JAVA
rem "Set Defaults."
set ARTEMIS_LOGGING_CONF=file:%ARTEMIS_INSTANCE%\etc\logging.properties
set ARTEMIS_LOGGING_CONF=%ARTEMIS_INSTANCE_URI%/etc/logging.properties
set ARTEMIS_DATA_DIR=%ARTEMIS_INSTANCE%\data
set ARTEMIS_LOG_MANAGER=org.jboss.logmanager.LogManager

View File

@ -18,6 +18,11 @@
ARTEMIS_HOME='${artemis.home}'
ARTEMIS_INSTANCE='${artemis.instance}'
# The logging config will need an URI
# this will be encoded in case you use spaces or special characters
# on your directory structure
ARTEMIS_INSTANCE_URI='${artemis.instance.uri}'
# Cluster Properties: Used to pass arguments to ActiveMQ Artemis which can be referenced in broker.xml
#ARTEMIS_CLUSTER_PROPS="-Dactivemq.remoting.default.port=61617 -Dactivemq.remoting.amqp.port=5673 -Dactivemq.remoting.stomp.port=61614 -Dactivemq.remoting.hornetq.port=5446"

View File

@ -19,6 +19,11 @@ rem under the License.
set ARTEMIS_HOME="${artemis.home}"
set ARTEMIS_INSTANCE="${artemis.instance}"
rem The logging config will need an URI
rem this will be encoded in case you use spaces or special characters
rem on your directory structure
set ARTEMIS_INSTANCE_URI="${artemis.instance.uri}"
rem Cluster Properties: Used to pass arguments to ActiveMQ Artemis which can be referenced in broker.xml
rem set ARTEMIS_CLUSTER_PROPS=-Dactivemq.remoting.default.port=61617 -Dactivemq.remoting.amqp.port=5673 -Dactivemq.remoting.stomp.port=61614 -Dactivemq.remoting.hornetq.port=5446