From dd300c1a17edffcdde2d660845e411a0fb4fa388 Mon Sep 17 00:00:00 2001 From: Brad Wood Date: Fri, 8 Apr 2022 13:28:27 -0500 Subject: [PATCH] COMMANDBOX-1455 --- gradle/version | 2 +- src/main/java/runwar/logging/LoggerFactory.java | 6 +----- src/main/java/runwar/options/CommandLineHandler.java | 10 ++++++++++ src/main/java/runwar/options/ServerOptions.java | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/gradle/version b/gradle/version index 8193d7ce..fb5f09b3 100644 --- a/gradle/version +++ b/gradle/version @@ -1 +1 @@ -4.7.2-03cc4ff8e3fb271a339af4efbdefab751db87dc9-70d36e81a8b364649708b309d1741b798c6a36b1 \ No newline at end of file +4.7.3-8cded729fa5fd97ad7d29c14702230eade9da17c-70d36e81a8b364649708b309d1741b798c6a36b1 \ No newline at end of file diff --git a/src/main/java/runwar/logging/LoggerFactory.java b/src/main/java/runwar/logging/LoggerFactory.java index 386451e0..388692ea 100644 --- a/src/main/java/runwar/logging/LoggerFactory.java +++ b/src/main/java/runwar/logging/LoggerFactory.java @@ -237,7 +237,7 @@ public static void configureUrlRewriteLoggers(boolean isTrace, Configuration log urlrewriteLoggers.forEach(logger -> { log4jConfig.addLogger(logger.getName(), logger); }); - + if (isTrace) { RunwarLogger.CONF_LOG.infof("Enabling URL rewrite log level: %s", "TRACE"); urlrewriteLoggers.forEach(logger -> { @@ -253,10 +253,6 @@ public static void configureUrlRewriteLoggers(boolean isTrace, Configuration log }); } - - System.out.println("serverOptions.urlRewriteLog() "); - System.out.println(serverOptions.urlRewriteLog()); - if (serverOptions.urlRewriteLog() != null) { rewriteLogAppender = RollingFileAppender.newBuilder() .setName("URLRewriteFileLogger") diff --git a/src/main/java/runwar/options/CommandLineHandler.java b/src/main/java/runwar/options/CommandLineHandler.java index 4d8bf865..60925312 100644 --- a/src/main/java/runwar/options/CommandLineHandler.java +++ b/src/main/java/runwar/options/CommandLineHandler.java @@ -656,6 +656,12 @@ private static Options getOptions() { .hasArg().withArgName("true|false") .create(Keys.AUTOCREATECONTEXTSVDIRS)); + options.addOption(OptionBuilder + .withLongOpt("log-pattern") + .withDescription("Log4j formatter pattern for log messages") + .hasArg().withArgName("[%-5p] %c: %m%n") + .create(Keys.LOGPATTERN)); + options.addOption(new Option("h", Keys.HELP, false, "print this message")); options.addOption(new Option("v", "version", false, "print runwar version and undertow version")); @@ -692,6 +698,10 @@ public static ServerOptions parseLogArguments(String[] args, ServerOptions serve serverOptions.logLevel(line.getOptionValue("level")); } + if (hasOptionValue(line, Keys.LOGPATTERN)) { + serverOptions.logPattern(line.getOptionValue(Keys.LOGPATTERN)); + } + if (line.hasOption(Keys.WAR)) { String warPath = line.getOptionValue(Keys.WAR); serverOptions.warFile(getFile(warPath)); diff --git a/src/main/java/runwar/options/ServerOptions.java b/src/main/java/runwar/options/ServerOptions.java index 65ce5be6..d92bb5e1 100644 --- a/src/main/java/runwar/options/ServerOptions.java +++ b/src/main/java/runwar/options/ServerOptions.java @@ -123,7 +123,7 @@ public static final class Keys { final static String AUTOCREATECONTEXTSSECRET="autoCreateContextsSecret"; final static String AUTOCREATECONTEXTSMAX="autoCreateContextsMax"; final static String AUTOCREATECONTEXTSVDIRS="autoCreateContextsVDirs"; - + final static String LOGPATTERN="logPattern"; }