This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/master by this push: new 21121d8f6c [MNG-8503] Configure logging using maven.logger.* properties rather than org.slf4j.simpleLogger.* (#2048) 21121d8f6c is described below commit 21121d8f6ce70336daeadf8d91c5566ea81e27e3 Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Mon Jan 27 15:09:46 2025 +0100 [MNG-8503] Configure logging using maven.logger.* properties rather than org.slf4j.simpleLogger.* (#2048) --- ...lelogger.properties => maven.logger.properties} | 22 +- .../main/java/org/apache/maven/api/Constants.java | 112 +++++++ .../logging/impl/MavenSimpleConfiguration.java | 6 +- .../org/apache/maven/slf4j/MavenBaseLogger.java | 64 ++-- .../maven/slf4j/SimpleLoggerConfiguration.java | 79 ++++- .../maven/slf4j/MavenBaseLoggerTimestampTest.java | 21 +- src/site/markdown/configuration.properties | 322 +++++++++++++-------- src/site/markdown/configuration.yaml | 66 +++++ src/site/markdown/maven-configuration.md | 11 + 9 files changed, 491 insertions(+), 212 deletions(-) diff --git a/apache-maven/src/assembly/maven/conf/logging/simplelogger.properties b/apache-maven/src/assembly/maven/conf/logging/maven.logger.properties similarity index 63% rename from apache-maven/src/assembly/maven/conf/logging/simplelogger.properties rename to apache-maven/src/assembly/maven/conf/logging/maven.logger.properties index 8c4a5d1e4b..18c71c687c 100644 --- a/apache-maven/src/assembly/maven/conf/logging/simplelogger.properties +++ b/apache-maven/src/assembly/maven/conf/logging/maven.logger.properties @@ -15,16 +15,16 @@ # specific language governing permissions and limitations # under the License. -org.slf4j.simpleLogger.defaultLogLevel=info -org.slf4j.simpleLogger.showDateTime=false -org.slf4j.simpleLogger.showThreadName=false -org.slf4j.simpleLogger.showLogName=false -org.slf4j.simpleLogger.logFile=System.out -org.slf4j.simpleLogger.cacheOutputStream=true -org.slf4j.simpleLogger.levelInBrackets=true -org.slf4j.simpleLogger.log.Sisu=info -org.slf4j.simpleLogger.warnLevelString=WARNING +maven.logger.defaultLogLevel=info +maven.logger.showDateTime=false +maven.logger.showThreadName=false +maven.logger.showLogName=false +maven.logger.logFile=System.out +maven.logger.cacheOutputStream=true +maven.logger.levelInBrackets=true +maven.logger.log.Sisu=info +maven.logger.warnLevelString=WARNING # MNG-6181: mvn -X also prints all debug logging from HttpClient -org.slf4j.simpleLogger.log.org.apache.http=off -org.slf4j.simpleLogger.log.org.apache.http.wire=off +maven.logger.log.org.apache.http=off +maven.logger.log.org.apache.http.wire=off diff --git a/api/maven-api-core/src/main/java/org/apache/maven/api/Constants.java b/api/maven-api-core/src/main/java/org/apache/maven/api/Constants.java index f3e76f891a..76575ef131 100644 --- a/api/maven-api-core/src/main/java/org/apache/maven/api/Constants.java +++ b/api/maven-api-core/src/main/java/org/apache/maven/api/Constants.java @@ -453,5 +453,117 @@ public final class Constants { @Config(type = "java.lang.Integer", defaultValue = "100") public static final String MAVEN_BUILDER_MAX_PROBLEMS = "maven.builder.maxProblems"; + /** + * All system properties used by Maven Logger start with this prefix. + * + * @since 4.0.0 + */ + public static final String MAVEN_LOGGER_PREFIX = "maven.logger."; + + /** + * Default log level for all instances of SimpleLogger. Must be one of ("trace", "debug", "info", + * "warn", "error" or "off"). If not specified, defaults to "info". + * + * @since 4.0.0 + */ + @Config + public static final String MAVEN_LOGGER_DEFAULT_LOG_LEVEL = MAVEN_LOGGER_PREFIX + "defaultLogLevel"; + + /** + * Set to true if you want the current date and time to be included in output messages. Default is false. + * + * @since 4.0.0 + */ + @Config(type = "java.lang.Boolean", defaultValue = "false") + public static final String MAVEN_LOGGER_SHOW_DATE_TIME = MAVEN_LOGGER_PREFIX + "showDateTime"; + + /** + * The date and time format to be used in the output messages. The pattern describing the date and + * time format is defined by SimpleDateFormat. If the format is not specified or is invalid, the + * number of milliseconds since start up will be output. + * + * @since 4.0.0 + */ + @Config + public static final String MAVEN_LOGGER_DATE_TIME_FORMAT = MAVEN_LOGGER_PREFIX + "dateTimeFormat"; + + /** + * If you would like to output the current thread id, then set to true. Defaults to false. + * + * @since 4.0.0 + */ + @Config(type = "java.lang.Boolean", defaultValue = "false") + public static final String MAVEN_LOGGER_SHOW_THREAD_ID = MAVEN_LOGGER_PREFIX + "showThreadId"; + + /** + * Set to true if you want to output the current thread name. Defaults to true. + * + * @since 4.0.0 + */ + @Config(type = "java.lang.Boolean", defaultValue = "true") + public static final String MAVEN_LOGGER_SHOW_THREAD_NAME = MAVEN_LOGGER_PREFIX + "showThreadName"; + + /** + * Set to true if you want the Logger instance name to be included in output messages. Defaults to true. + * + * @since 4.0.0 + */ + @Config(type = "java.lang.Boolean", defaultValue = "true") + public static final String MAVEN_LOGGER_SHOW_LOG_NAME = MAVEN_LOGGER_PREFIX + "showLogName"; + + /** + * Set to true if you want the last component of the name to be included in output messages. Defaults to false. + * + * @since 4.0.0 + */ + @Config(type = "java.lang.Boolean", defaultValue = "false") + public static final String MAVEN_LOGGER_SHOW_SHORT_LOG_NAME = MAVEN_LOGGER_PREFIX + "showShortLogName"; + + /** + * The output target which can be the path to a file, or the special values "System.out" and "System.err". + * Default is "System.err". + * + * @since 4.0.0 + */ + @Config + public static final String MAVEN_LOGGER_LOG_FILE = MAVEN_LOGGER_PREFIX + "logFile"; + + /** + * Should the level string be output in brackets? Defaults to false. + * + * @since 4.0.0 + */ + @Config(type = "java.lang.Boolean", defaultValue = "false") + public static final String MAVEN_LOGGER_LEVEL_IN_BRACKETS = MAVEN_LOGGER_PREFIX + "levelInBrackets"; + + /** + * The string value output for the warn level. Defaults to WARN. + * + * @since 4.0.0 + */ + @Config(defaultValue = "WARN") + public static final String MAVEN_LOGGER_WARN_LEVEL = MAVEN_LOGGER_PREFIX + "warnLevelString"; + + /** + * If the output target is set to "System.out" or "System.err" (see preceding entry), by default, logs will + * be output to the latest value referenced by System.out/err variables. By setting this parameter to true, + * the output stream will be cached, i.e. assigned once at initialization time and re-used independently of + * the current value referenced by System.out/err. + * + * @since 4.0.0 + */ + @Config(type = "java.lang.Boolean", defaultValue = "false") + public static final String MAVEN_LOGGER_CACHE_OUTPUT_STREAM = MAVEN_LOGGER_PREFIX + "cacheOutputStream"; + + /** + * maven.logger.log.a.b.c - Logging detail level for a SimpleLogger instance named "a.b.c". Right-side value + * must be one of "trace", "debug", "info", "warn", "error" or "off". When a logger named "a.b.c" is initialized, + * its level is assigned from this property. If unspecified, the level of nearest parent logger will be used, + * and if none is set, then the value specified by {@code maven.logger.defaultLogLevel} will be used. + * + * @since 4.0.0 + */ + public static final String MAVEN_LOGGER_LOG_PREFIX = MAVEN_LOGGER_PREFIX + "log."; + private Constants() {} } diff --git a/impl/maven-cli/src/main/java/org/apache/maven/cling/logging/impl/MavenSimpleConfiguration.java b/impl/maven-cli/src/main/java/org/apache/maven/cling/logging/impl/MavenSimpleConfiguration.java index af17432a13..2c407d6bee 100644 --- a/impl/maven-cli/src/main/java/org/apache/maven/cling/logging/impl/MavenSimpleConfiguration.java +++ b/impl/maven-cli/src/main/java/org/apache/maven/cling/logging/impl/MavenSimpleConfiguration.java @@ -18,9 +18,9 @@ */ package org.apache.maven.cling.logging.impl; +import org.apache.maven.api.Constants; import org.apache.maven.cling.logging.BaseSlf4jConfiguration; import org.apache.maven.slf4j.MavenLoggerFactory; -import org.apache.maven.slf4j.MavenSimpleLogger; import org.slf4j.ILoggerFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,10 +42,10 @@ public void setRootLoggerLevel(Level level) { default -> "error"; }; - String current = System.setProperty(MavenSimpleLogger.DEFAULT_LOG_LEVEL_KEY, value); + String current = System.setProperty(Constants.MAVEN_LOGGER_DEFAULT_LOG_LEVEL, value); if (current != null && !value.equalsIgnoreCase(current)) { LOGGER.info( - "System property '" + MavenSimpleLogger.DEFAULT_LOG_LEVEL_KEY + "' is already set to '" + current + "System property '" + Constants.MAVEN_LOGGER_DEFAULT_LOG_LEVEL + "' is already set to '" + current + "' - ignoring system property and get log level from -X/-e/-q options, log level will be set to" + value); } diff --git a/impl/maven-logging/src/main/java/org/apache/maven/slf4j/MavenBaseLogger.java b/impl/maven-logging/src/main/java/org/apache/maven/slf4j/MavenBaseLogger.java index cd8d1e19f0..4b8edb6227 100644 --- a/impl/maven-logging/src/main/java/org/apache/maven/slf4j/MavenBaseLogger.java +++ b/impl/maven-logging/src/main/java/org/apache/maven/slf4j/MavenBaseLogger.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List; +import org.apache.maven.api.Constants; import org.apache.maven.api.MonotonicClock; import org.slf4j.Logger; import org.slf4j.Marker; @@ -43,11 +44,11 @@ * * * <ul> - * <li><code>org.slf4j.simpleLogger.logFile</code> - The output target which can + * <li><code>maven.logger.logFile</code> - The output target which can * be the <em>path</em> to a file, or the special values "System.out" and * "System.err". Default is "System.err".</li> * - * <li><code>org.slf4j.simpleLogger.cacheOutputStream</code> - If the output + * <li><code>maven.logger.cacheOutputStream</code> - If the output * target is set to "System.out" or "System.err" (see preceding entry), by * default, logs will be output to the latest value referenced by * <code>System.out/err</code> variables. By setting this parameter to true, the @@ -55,49 +56,49 @@ * re-used independently of the current value referenced by * <code>System.out/err</code>.</li> * - * <li><code>org.slf4j.simpleLogger.defaultLogLevel</code> - Default log level + * <li><code>maven.logger.defaultLogLevel</code> - Default log level * for all instances of SimpleLogger. Must be one of ("trace", "debug", "info", * "warn", "error" or "off"). If not specified, defaults to "info".</li> * - * <li><code>org.slf4j.simpleLogger.log.<em>a.b.c</em></code> - Logging detail + * <li><code>maven.logger.log.<em>a.b.c</em></code> - Logging detail * level for a SimpleLogger instance named "a.b.c". Right-side value must be one * of "trace", "debug", "info", "warn", "error" or "off". When a SimpleLogger * named "a.b.c" is initialized, its level is assigned from this property. If * unspecified, the level of nearest parent logger will be used, and if none is * set, then the value specified by - * <code>org.slf4j.simpleLogger.defaultLogLevel</code> will be used.</li> + * <code>maven.logger.defaultLogLevel</code> will be used.</li> * - * <li><code>org.slf4j.simpleLogger.showDateTime</code> - Set to + * <li><code>maven.logger.showDateTime</code> - Set to * <code>true</code> if you want the current date and time to be included in * output messages. Default is <code>false</code></li> * - * <li><code>org.slf4j.simpleLogger.dateTimeFormat</code> - The date and time + * <li><code>maven.logger.dateTimeFormat</code> - The date and time * format to be used in the output messages. The pattern describing the date and * time format is defined by <a href= * "http://docs.oracle.com/javase/1.5.0/docs/api/java/text/SimpleDateFormat.html"> * <code>SimpleDateFormat</code></a>. If the format is not specified or is * invalid, the number of milliseconds since start up will be output.</li> * - * <li><code>org.slf4j.simpleLogger.showThreadName</code> -Set to + * <li><code>maven.logger.showThreadName</code> -Set to * <code>true</code> if you want to output the current thread name. Defaults to * <code>true</code>.</li> * - * <li>(since version 1.7.33 and 2.0.0-alpha6) <code>org.slf4j.simpleLogger.showThreadId</code> - + * <li>(since version 1.7.33 and 2.0.0-alpha6) <code>maven.logger.showThreadId</code> - * If you would like to output the current thread id, then set to * <code>true</code>. Defaults to <code>false</code>.</li> * - * <li><code>org.slf4j.simpleLogger.showLogName</code> - Set to + * <li><code>maven.logger.showLogName</code> - Set to * <code>true</code> if you want the Logger instance name to be included in * output messages. Defaults to <code>true</code>.</li> * - * <li><code>org.slf4j.simpleLogger.showShortLogName</code> - Set to + * <li><code>maven.logger.showShortLogName</code> - Set to * <code>true</code> if you want the last component of the name to be included * in output messages. Defaults to <code>false</code>.</li> * - * <li><code>org.slf4j.simpleLogger.levelInBrackets</code> - Should the level + * <li><code>maven.logger.levelInBrackets</code> - Should the level * string be output in brackets? Defaults to <code>false</code>.</li> * - * <li><code>org.slf4j.simpleLogger.warnLevelString</code> - The string value + * <li><code>maven.logger.warnLevelString</code> - The string value * output for the warn level. Defaults to <code>WARN</code>.</li> * * </ul> @@ -184,34 +185,9 @@ static void init() { private transient String shortLogName = null; /** - * All system properties used by <code>SimpleLogger</code> start with this - * prefix + * Legacy SLF4J prefix maintained for backwards compatibility */ - public static final String SYSTEM_PREFIX = "org.slf4j.simpleLogger."; - - public static final String LOG_KEY_PREFIX = MavenBaseLogger.SYSTEM_PREFIX + "log."; - - public static final String CACHE_OUTPUT_STREAM_STRING_KEY = MavenBaseLogger.SYSTEM_PREFIX + "cacheOutputStream"; - - public static final String WARN_LEVEL_STRING_KEY = MavenBaseLogger.SYSTEM_PREFIX + "warnLevelString"; - - public static final String LEVEL_IN_BRACKETS_KEY = MavenBaseLogger.SYSTEM_PREFIX + "levelInBrackets"; - - public static final String LOG_FILE_KEY = MavenBaseLogger.SYSTEM_PREFIX + "logFile"; - - public static final String SHOW_SHORT_LOG_NAME_KEY = MavenBaseLogger.SYSTEM_PREFIX + "showShortLogName"; - - public static final String SHOW_LOG_NAME_KEY = MavenBaseLogger.SYSTEM_PREFIX + "showLogName"; - - public static final String SHOW_THREAD_NAME_KEY = MavenBaseLogger.SYSTEM_PREFIX + "showThreadName"; - - public static final String SHOW_THREAD_ID_KEY = MavenBaseLogger.SYSTEM_PREFIX + "showThreadId"; - - public static final String DATE_TIME_FORMAT_KEY = MavenBaseLogger.SYSTEM_PREFIX + "dateTimeFormat"; - - public static final String SHOW_DATE_TIME_KEY = MavenBaseLogger.SYSTEM_PREFIX + "showDateTime"; - - public static final String DEFAULT_LOG_LEVEL_KEY = MavenBaseLogger.SYSTEM_PREFIX + "defaultLogLevel"; + public static final String LEGACY_PREFIX = "org.slf4j.simpleLogger."; /** * Protected access allows only {@link MavenLoggerFactory} and also derived classes to instantiate @@ -234,8 +210,8 @@ String recursivelyComputeLevelString() { int indexOfLastDot = tempName.length(); while ((levelString == null) && (indexOfLastDot > -1)) { tempName = tempName.substring(0, indexOfLastDot); - levelString = CONFIG_PARAMS.getStringProperty(MavenBaseLogger.LOG_KEY_PREFIX + tempName, null); - indexOfLastDot = String.valueOf(tempName).lastIndexOf("."); + levelString = CONFIG_PARAMS.getStringProperty(Constants.MAVEN_LOGGER_LOG_PREFIX + tempName, null); + indexOfLastDot = tempName.lastIndexOf("."); } return levelString; } @@ -244,8 +220,8 @@ String recursivelyComputeLevelString() { * To avoid intermingling of log messages and associated stack traces, the two * operations are done in a synchronized block. * - * @param buf - * @param t + * @param buf The StringBuilder containing the log message to be written + * @param t The Throwable object whose stack trace should be written, may be null */ protected void write(StringBuilder buf, Throwable t) { PrintStream targetStream = CONFIG_PARAMS.outputChoice.getTargetPrintStream(); diff --git a/impl/maven-logging/src/main/java/org/apache/maven/slf4j/SimpleLoggerConfiguration.java b/impl/maven-logging/src/main/java/org/apache/maven/slf4j/SimpleLoggerConfiguration.java index 0ea1a33498..18a2627166 100644 --- a/impl/maven-logging/src/main/java/org/apache/maven/slf4j/SimpleLoggerConfiguration.java +++ b/impl/maven-logging/src/main/java/org/apache/maven/slf4j/SimpleLoggerConfiguration.java @@ -25,6 +25,7 @@ import java.time.format.DateTimeFormatter; import java.util.Properties; +import org.apache.maven.api.Constants; import org.apache.maven.slf4j.OutputChoice.OutputChoiceType; import org.slf4j.helpers.Reporter; @@ -44,7 +45,10 @@ */ public class SimpleLoggerConfiguration { - private static final String CONFIGURATION_FILE = "simplelogger.properties"; + private static final String CONFIGURATION_FILE = "maven.logger.properties"; + + @Deprecated(since = "4.0.0") + private static final String LEGACY_CONFIGURATION_FILE = "simplelogger.properties"; static final int DEFAULT_LOG_LEVEL_DEFAULT = MavenBaseLogger.LOG_LEVEL_INFO; int defaultLogLevel = DEFAULT_LOG_LEVEL_DEFAULT; @@ -93,7 +97,7 @@ void init() { loadProperties(); - String defaultLogLevelString = getStringProperty(MavenBaseLogger.DEFAULT_LOG_LEVEL_KEY, null); + String defaultLogLevelString = getStringProperty(Constants.MAVEN_LOGGER_DEFAULT_LOG_LEVEL, null); if (defaultLogLevelString != null) { defaultLogLevel = stringToLevel(defaultLogLevelString); } @@ -101,20 +105,18 @@ void init() { // local variable, String dateTimeFormatStr; - showLogName = - getBooleanProperty(MavenBaseLogger.SHOW_LOG_NAME_KEY, SimpleLoggerConfiguration.SHOW_LOG_NAME_DEFAULT); - showShortLogName = getBooleanProperty(MavenBaseLogger.SHOW_SHORT_LOG_NAME_KEY, SHOW_SHORT_LOG_NAME_DEFAULT); - showDateTime = getBooleanProperty(MavenBaseLogger.SHOW_DATE_TIME_KEY, SHOW_DATE_TIME_DEFAULT); - showThreadName = getBooleanProperty(MavenBaseLogger.SHOW_THREAD_NAME_KEY, SHOW_THREAD_NAME_DEFAULT); - showThreadId = getBooleanProperty(MavenBaseLogger.SHOW_THREAD_ID_KEY, SHOW_THREAD_ID_DEFAULT); - dateTimeFormatStr = getStringProperty(MavenBaseLogger.DATE_TIME_FORMAT_KEY, DATE_TIME_FORMAT_STR_DEFAULT); - levelInBrackets = getBooleanProperty(MavenBaseLogger.LEVEL_IN_BRACKETS_KEY, LEVEL_IN_BRACKETS_DEFAULT); - warnLevelString = getStringProperty(MavenBaseLogger.WARN_LEVEL_STRING_KEY, WARN_LEVELS_STRING_DEFAULT); + showLogName = getBooleanProperty(Constants.MAVEN_LOGGER_SHOW_LOG_NAME, SHOW_LOG_NAME_DEFAULT); + showShortLogName = getBooleanProperty(Constants.MAVEN_LOGGER_SHOW_SHORT_LOG_NAME, SHOW_SHORT_LOG_NAME_DEFAULT); + showDateTime = getBooleanProperty(Constants.MAVEN_LOGGER_SHOW_DATE_TIME, SHOW_DATE_TIME_DEFAULT); + showThreadName = getBooleanProperty(Constants.MAVEN_LOGGER_SHOW_THREAD_NAME, SHOW_THREAD_NAME_DEFAULT); + showThreadId = getBooleanProperty(Constants.MAVEN_LOGGER_SHOW_THREAD_ID, SHOW_THREAD_ID_DEFAULT); + dateTimeFormatStr = getStringProperty(Constants.MAVEN_LOGGER_DATE_TIME_FORMAT, DATE_TIME_FORMAT_STR_DEFAULT); + levelInBrackets = getBooleanProperty(Constants.MAVEN_LOGGER_LEVEL_IN_BRACKETS, LEVEL_IN_BRACKETS_DEFAULT); + warnLevelString = getStringProperty(Constants.MAVEN_LOGGER_WARN_LEVEL, WARN_LEVELS_STRING_DEFAULT); - logFile = getStringProperty(MavenBaseLogger.LOG_FILE_KEY, logFile); + logFile = getStringProperty(Constants.MAVEN_LOGGER_LOG_FILE, logFile); - cacheOutputStream = - getBooleanProperty(MavenBaseLogger.CACHE_OUTPUT_STREAM_STRING_KEY, CACHE_OUTPUT_STREAM_DEFAULT); + cacheOutputStream = getBooleanProperty(Constants.MAVEN_LOGGER_CACHE_OUTPUT_STREAM, CACHE_OUTPUT_STREAM_DEFAULT); outputChoice = computeOutputChoice(logFile, cacheOutputStream); if (dateTimeFormatStr != null) { @@ -127,12 +129,36 @@ void init() { } private void loadProperties() { - // Add props from the resource simplelogger.properties ClassLoader threadCL = Thread.currentThread().getContextClassLoader(); ClassLoader toUseCL = (threadCL != null ? threadCL : ClassLoader.getSystemClassLoader()); + + // Try loading maven properties first + boolean mavenPropsLoaded = false; try (InputStream in = toUseCL.getResourceAsStream(CONFIGURATION_FILE)) { if (in != null) { properties.load(in); + mavenPropsLoaded = true; + } + } catch (java.io.IOException e) { + // ignored + } + + // Try loading legacy properties + try (InputStream in = toUseCL.getResourceAsStream(LEGACY_CONFIGURATION_FILE)) { + if (in != null) { + Properties legacyProps = new Properties(); + legacyProps.load(in); + if (!mavenPropsLoaded) { + Reporter.warn("Using deprecated " + LEGACY_CONFIGURATION_FILE + ". Please migrate to " + + CONFIGURATION_FILE); + } + // Only load legacy properties if there's no maven equivalent + for (String propName : legacyProps.stringPropertyNames()) { + String mavenKey = propName.replace(MavenBaseLogger.LEGACY_PREFIX, Constants.MAVEN_LOGGER_PREFIX); + if (!properties.containsKey(mavenKey)) { + properties.setProperty(mavenKey, legacyProps.getProperty(propName)); + } + } } } catch (java.io.IOException e) { // ignored @@ -152,11 +178,32 @@ boolean getBooleanProperty(String name, boolean defaultValue) { String getStringProperty(String name) { String prop = null; try { + // Try maven property first prop = System.getProperty(name); + if (prop == null && name.startsWith(Constants.MAVEN_LOGGER_PREFIX)) { + // Try legacy property + String legacyName = name.replace(Constants.MAVEN_LOGGER_PREFIX, MavenBaseLogger.LEGACY_PREFIX); + prop = System.getProperty(legacyName); + if (prop != null) { + Reporter.warn("Using deprecated property " + legacyName + ". Please migrate to " + name); + } + } } catch (SecurityException e) { // Ignore } - return (prop == null) ? properties.getProperty(name) : prop; + + if (prop == null) { + prop = properties.getProperty(name); + if (prop == null && name.startsWith(Constants.MAVEN_LOGGER_PREFIX)) { + // Try legacy property from properties file + String legacyName = name.replace(Constants.MAVEN_LOGGER_PREFIX, MavenBaseLogger.LEGACY_PREFIX); + prop = properties.getProperty(legacyName); + if (prop != null) { + Reporter.warn("Using deprecated property " + legacyName + ". Please migrate to " + name); + } + } + } + return prop; } static int stringToLevel(String levelStr) { diff --git a/impl/maven-logging/src/test/java/org/apache/maven/slf4j/MavenBaseLoggerTimestampTest.java b/impl/maven-logging/src/test/java/org/apache/maven/slf4j/MavenBaseLoggerTimestampTest.java index b79eb19984..18a43d74c5 100644 --- a/impl/maven-logging/src/test/java/org/apache/maven/slf4j/MavenBaseLoggerTimestampTest.java +++ b/impl/maven-logging/src/test/java/org/apache/maven/slf4j/MavenBaseLoggerTimestampTest.java @@ -21,6 +21,7 @@ import java.io.ByteArrayOutputStream; import java.io.PrintStream; +import org.apache.maven.api.Constants; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -39,8 +40,8 @@ class MavenBaseLoggerTimestampTest { @BeforeEach void setUp() { // Reset configuration before each test - System.clearProperty(MavenBaseLogger.SHOW_DATE_TIME_KEY); - System.clearProperty(MavenBaseLogger.DATE_TIME_FORMAT_KEY); + System.clearProperty(Constants.MAVEN_LOGGER_SHOW_DATE_TIME); + System.clearProperty(Constants.MAVEN_LOGGER_DATE_TIME_FORMAT); // Reset static initialization flag MavenBaseLogger.initialized = false; @@ -54,15 +55,15 @@ void setUp() { @AfterEach void tearDown() { System.setErr(originalErr); - System.clearProperty(MavenBaseLogger.SHOW_DATE_TIME_KEY); - System.clearProperty(MavenBaseLogger.DATE_TIME_FORMAT_KEY); + System.clearProperty(Constants.MAVEN_LOGGER_SHOW_DATE_TIME); + System.clearProperty(Constants.MAVEN_LOGGER_DATE_TIME_FORMAT); MavenBaseLogger.initialized = false; } @Test void whenShowDateTimeIsFalse_shouldNotIncludeTimestamp() { // Given - System.setProperty(MavenBaseLogger.SHOW_DATE_TIME_KEY, "false"); + System.setProperty(Constants.MAVEN_LOGGER_SHOW_DATE_TIME, "false"); initializeLogger(); // When @@ -77,7 +78,7 @@ void whenShowDateTimeIsFalse_shouldNotIncludeTimestamp() { @Test void whenShowDateTimeIsTrue_withoutFormat_shouldShowElapsedTime() { // Changed test name and expectation // Given - System.setProperty(MavenBaseLogger.SHOW_DATE_TIME_KEY, "true"); + System.setProperty(Constants.MAVEN_LOGGER_SHOW_DATE_TIME, "true"); initializeLogger(); // When @@ -95,8 +96,8 @@ void whenShowDateTimeIsTrue_withoutFormat_shouldShowElapsedTime() { // Changed t @ValueSource(strings = {"yyyy-MM-dd HH:mm:ss", "dd/MM/yyyy HH:mm:ss.SSS", "HH:mm:ss"}) void whenCustomDateFormat_shouldFormatCorrectly(String dateFormat) { // Given - System.setProperty(MavenBaseLogger.SHOW_DATE_TIME_KEY, "true"); - System.setProperty(MavenBaseLogger.DATE_TIME_FORMAT_KEY, dateFormat); + System.setProperty(Constants.MAVEN_LOGGER_SHOW_DATE_TIME, "true"); + System.setProperty(Constants.MAVEN_LOGGER_DATE_TIME_FORMAT, dateFormat); initializeLogger(); // When @@ -124,8 +125,8 @@ void whenCustomDateFormat_shouldFormatCorrectly(String dateFormat) { @Test void whenInvalidDateFormat_shouldUseElapsedMillis() { // Given - System.setProperty(MavenBaseLogger.SHOW_DATE_TIME_KEY, "true"); - System.setProperty(MavenBaseLogger.DATE_TIME_FORMAT_KEY, "invalid-format"); + System.setProperty(Constants.MAVEN_LOGGER_SHOW_DATE_TIME, "true"); + System.setProperty(Constants.MAVEN_LOGGER_DATE_TIME_FORMAT, "invalid-format"); initializeLogger(); // When diff --git a/src/site/markdown/configuration.properties b/src/site/markdown/configuration.properties index cd51535b2f..0031cac310 100644 --- a/src/site/markdown/configuration.properties +++ b/src/site/markdown/configuration.properties @@ -16,7 +16,7 @@ # specific language governing permissions and limitations # under the License. # -props.count = 45 +props.count = 56 props.1.key = maven.build.timestamp.format props.1.configurationType = String props.1.description = Build timestamp format. @@ -76,212 +76,278 @@ props.10.description = Maven installation toolchains. props.10.defaultValue = ${maven.installation.conf}/toolchains.xml props.10.since = 4.0.0 props.10.configurationSource = User properties -props.11.key = maven.modelBuilder.parallelism -props.11.configurationType = Integer -props.11.description = ProjectBuilder parallelism. -props.11.defaultValue = cores/2 + 1 +props.11.key = maven.logger.cacheOutputStream +props.11.configurationType = Boolean +props.11.description = If the output target is set to "System.out" or "System.err" (see preceding entry), by default, logs will be output to the latest value referenced by System.out/err variables. By setting this parameter to true, the output stream will be cached, i.e. assigned once at initialization time and re-used independently of the current value referenced by System.out/err. +props.11.defaultValue = false props.11.since = 4.0.0 props.11.configurationSource = User properties -props.12.key = maven.plugin.validation +props.12.key = maven.logger.dateTimeFormat props.12.configurationType = String -props.12.description = Plugin validation level. -props.12.defaultValue = inline -props.12.since = 3.9.2 +props.12.description = The date and time format to be used in the output messages. The pattern describing the date and time format is defined by SimpleDateFormat. If the format is not specified or is invalid, the number of milliseconds since start up will be output. +props.12.defaultValue = +props.12.since = 4.0.0 props.12.configurationSource = User properties -props.13.key = maven.plugin.validation.excludes +props.13.key = maven.logger.defaultLogLevel props.13.configurationType = String -props.13.description = Plugin validation exclusions. +props.13.description = Default log level for all instances of SimpleLogger. Must be one of ("trace", "debug", "info", "warn", "error" or "off"). If not specified, defaults to "info". props.13.defaultValue = -props.13.since = 3.9.6 +props.13.since = 4.0.0 props.13.configurationSource = User properties -props.14.key = maven.project.conf -props.14.configurationType = String -props.14.description = Maven project configuration directory. -props.14.defaultValue = ${session.rootDirectory}/.mvn +props.14.key = maven.logger.levelInBrackets +props.14.configurationType = Boolean +props.14.description = Should the level string be output in brackets? Defaults to false. +props.14.defaultValue = false props.14.since = 4.0.0 props.14.configurationSource = User properties -props.15.key = maven.project.extensions +props.15.key = maven.logger.logFile props.15.configurationType = String -props.15.description = Maven project extensions. -props.15.defaultValue = ${maven.project.conf}/extensions.xml +props.15.description = The output target which can be the path to a file, or the special values "System.out" and "System.err". Default is "System.err". +props.15.defaultValue = props.15.since = 4.0.0 props.15.configurationSource = User properties -props.16.key = maven.project.settings -props.16.configurationType = String -props.16.description = Maven project settings. -props.16.defaultValue = ${maven.project.conf}/settings.xml +props.16.key = maven.logger.showDateTime +props.16.configurationType = Boolean +props.16.description = Set to true if you want the current date and time to be included in output messages. Default is false. +props.16.defaultValue = false props.16.since = 4.0.0 props.16.configurationSource = User properties -props.17.key = maven.relocations.entries -props.17.configurationType = String -props.17.description = User controlled relocations. This property is a comma separated list of entries with the syntax <code>GAV>GAV</code>. The first <code>GAV</code> can contain <code>\*</code> for any elem (so <code>\*:\*:\*</code> would mean ALL, something you don't want). The second <code>GAV</code> is either fully specified, or also can contain <code>\*</code>, then it behaves as "ordinary relocation": the coordinate is preserved from relocated artifact. Finally, if right hand < [...] -props.17.defaultValue = +props.17.key = maven.logger.showLogName +props.17.configurationType = Boolean +props.17.description = Set to true if you want the Logger instance name to be included in output messages. Defaults to true. +props.17.defaultValue = true props.17.since = 4.0.0 props.17.configurationSource = User properties -props.18.key = maven.repo.central -props.18.configurationType = String -props.18.description = Maven central repository URL. The property will have the value of the <code>MAVEN_REPO_CENTRAL</code> environment variable if it is defined. -props.18.defaultValue = https://repo.maven.apache.org/maven2 +props.18.key = maven.logger.showShortLogName +props.18.configurationType = Boolean +props.18.description = Set to true if you want the last component of the name to be included in output messages. Defaults to false. +props.18.defaultValue = false props.18.since = 4.0.0 props.18.configurationSource = User properties -props.19.key = maven.repo.local -props.19.configurationType = String -props.19.description = Maven local repository. -props.19.defaultValue = ${maven.user.conf}/repository -props.19.since = 3.0.0 +props.19.key = maven.logger.showThreadId +props.19.configurationType = Boolean +props.19.description = If you would like to output the current thread id, then set to true. Defaults to false. +props.19.defaultValue = false +props.19.since = 4.0.0 props.19.configurationSource = User properties -props.20.key = maven.repo.local.head -props.20.configurationType = String -props.20.description = User property for chained LRM: the new "head" local repository to use, and "push" the existing into tail. Similar to <code>maven.repo.local.tail</code>, this property may contain comma separated list of paths to be used as local repositories (combine with chained local repository), but while latter is "appending" this one is "prepending". -props.20.defaultValue = +props.20.key = maven.logger.showThreadName +props.20.configurationType = Boolean +props.20.description = Set to true if you want to output the current thread name. Defaults to true. +props.20.defaultValue = true props.20.since = 4.0.0 props.20.configurationSource = User properties -props.21.key = maven.repo.local.recordReverseTree +props.21.key = maven.logger.warnLevelString props.21.configurationType = String -props.21.description = User property for reverse dependency tree. If enabled, Maven will record ".tracking" directory into local repository with "reverse dependency tree", essentially explaining WHY given artifact is present in local repository. Default: <code>false</code>, will not record anything. -props.21.defaultValue = false -props.21.since = 3.9.0 +props.21.description = The string value output for the warn level. Defaults to WARN. +props.21.defaultValue = WARN +props.21.since = 4.0.0 props.21.configurationSource = User properties -props.22.key = maven.repo.local.tail -props.22.configurationType = String -props.22.description = User property for chained LRM: list of "tail" local repository paths (separated by comma), to be used with <code>org.eclipse.aether.util.repository.ChainedLocalRepositoryManager</code>. Default value: <code>null</code>, no chained LRM is used. -props.22.defaultValue = -props.22.since = 3.9.0 +props.22.key = maven.modelBuilder.parallelism +props.22.configurationType = Integer +props.22.description = ProjectBuilder parallelism. +props.22.defaultValue = cores/2 + 1 +props.22.since = 4.0.0 props.22.configurationSource = User properties -props.23.key = maven.repo.local.tail.ignoreAvailability +props.23.key = maven.plugin.validation props.23.configurationType = String -props.23.description = User property for chained LRM: whether to ignore "availability check" in tail or not. Usually you do want to ignore it. This property is mapped onto corresponding Resolver 2.x property, is like a synonym for it. Default value: <code>true</code>. -props.23.defaultValue = -props.23.since = 3.9.0 +props.23.description = Plugin validation level. +props.23.defaultValue = inline +props.23.since = 3.9.2 props.23.configurationSource = User properties -props.24.key = maven.resolver.dependencyManagerTransitivity +props.24.key = maven.plugin.validation.excludes props.24.configurationType = String -props.24.description = User property for selecting dependency manager behaviour regarding transitive dependencies and dependency management entries in their POMs. Maven 3 targeted full backward compatibility with Maven2, hence it ignored dependency management entries in transitive dependency POMs. Maven 4 enables "transitivity" by default, hence unlike Maven2, obeys dependency management entries deep in dependency graph as well. <br/> Default: <code>"true"</code>. -props.24.defaultValue = true -props.24.since = 4.0.0 +props.24.description = Plugin validation exclusions. +props.24.defaultValue = +props.24.since = 3.9.6 props.24.configurationSource = User properties -props.25.key = maven.resolver.transport +props.25.key = maven.project.conf props.25.configurationType = String -props.25.description = Resolver transport to use. Can be <code>default</code>, <code>wagon</code>, <code>apache</code>, <code>jdk</code> or <code>auto</code>. -props.25.defaultValue = default +props.25.description = Maven project configuration directory. +props.25.defaultValue = ${session.rootDirectory}/.mvn props.25.since = 4.0.0 props.25.configurationSource = User properties -props.26.key = maven.session.versionFilter +props.26.key = maven.project.extensions props.26.configurationType = String -props.26.description = User property for version filter expression used in session, applied to resolving ranges: a semicolon separated list of filters to apply. By default, no version filter is applied (like in Maven 3). <br/> Supported filters: <ul> <li>"h" or "h(num)" - highest version or top list of highest ones filter</li> <li>"l" or "l(num)" - lowest version or bottom list of lowest ones filter</li> <li>"s" - contextual snapshot filter</li> <li>"e(G:A:V)" - predicate filter (leaves [...] -props.26.defaultValue = +props.26.description = Maven project extensions. +props.26.defaultValue = ${maven.project.conf}/extensions.xml props.26.since = 4.0.0 props.26.configurationSource = User properties -props.27.key = maven.settings.security +props.27.key = maven.project.settings props.27.configurationType = String -props.27.description = -props.27.defaultValue = ${maven.user.conf}/settings-security4.xml +props.27.description = Maven project settings. +props.27.defaultValue = ${maven.project.conf}/settings.xml +props.27.since = 4.0.0 props.27.configurationSource = User properties -props.28.key = maven.startInstant -props.28.configurationType = java.time.Instant -props.28.description = User property used to store the build timestamp. +props.28.key = maven.relocations.entries +props.28.configurationType = String +props.28.description = User controlled relocations. This property is a comma separated list of entries with the syntax <code>GAV>GAV</code>. The first <code>GAV</code> can contain <code>\*</code> for any elem (so <code>\*:\*:\*</code> would mean ALL, something you don't want). The second <code>GAV</code> is either fully specified, or also can contain <code>\*</code>, then it behaves as "ordinary relocation": the coordinate is preserved from relocated artifact. Finally, if right hand < [...] props.28.defaultValue = props.28.since = 4.0.0 props.28.configurationSource = User properties -props.29.key = maven.style.color +props.29.key = maven.repo.central props.29.configurationType = String -props.29.description = Maven output color mode. Allowed values are <code>auto</code>, <code>always</code>, <code>never</code>. -props.29.defaultValue = auto +props.29.description = Maven central repository URL. The property will have the value of the <code>MAVEN_REPO_CENTRAL</code> environment variable if it is defined. +props.29.defaultValue = https://repo.maven.apache.org/maven2 props.29.since = 4.0.0 props.29.configurationSource = User properties -props.30.key = maven.style.debug +props.30.key = maven.repo.local props.30.configurationType = String -props.30.description = Color style for debug messages. -props.30.defaultValue = bold,f:cyan -props.30.since = 4.0.0 +props.30.description = Maven local repository. +props.30.defaultValue = ${maven.user.conf}/repository +props.30.since = 3.0.0 props.30.configurationSource = User properties -props.31.key = maven.style.error +props.31.key = maven.repo.local.head props.31.configurationType = String -props.31.description = Color style for error messages. -props.31.defaultValue = bold,f:red +props.31.description = User property for chained LRM: the new "head" local repository to use, and "push" the existing into tail. Similar to <code>maven.repo.local.tail</code>, this property may contain comma separated list of paths to be used as local repositories (combine with chained local repository), but while latter is "appending" this one is "prepending". +props.31.defaultValue = props.31.since = 4.0.0 props.31.configurationSource = User properties -props.32.key = maven.style.failure +props.32.key = maven.repo.local.recordReverseTree props.32.configurationType = String -props.32.description = Color style for failure messages. -props.32.defaultValue = bold,f:red -props.32.since = 4.0.0 +props.32.description = User property for reverse dependency tree. If enabled, Maven will record ".tracking" directory into local repository with "reverse dependency tree", essentially explaining WHY given artifact is present in local repository. Default: <code>false</code>, will not record anything. +props.32.defaultValue = false +props.32.since = 3.9.0 props.32.configurationSource = User properties -props.33.key = maven.style.info +props.33.key = maven.repo.local.tail props.33.configurationType = String -props.33.description = Color style for info messages. -props.33.defaultValue = bold,f:blue -props.33.since = 4.0.0 +props.33.description = User property for chained LRM: list of "tail" local repository paths (separated by comma), to be used with <code>org.eclipse.aether.util.repository.ChainedLocalRepositoryManager</code>. Default value: <code>null</code>, no chained LRM is used. +props.33.defaultValue = +props.33.since = 3.9.0 props.33.configurationSource = User properties -props.34.key = maven.style.mojo +props.34.key = maven.repo.local.tail.ignoreAvailability props.34.configurationType = String -props.34.description = Color style for mojo messages. -props.34.defaultValue = f:green -props.34.since = 4.0.0 +props.34.description = User property for chained LRM: whether to ignore "availability check" in tail or not. Usually you do want to ignore it. This property is mapped onto corresponding Resolver 2.x property, is like a synonym for it. Default value: <code>true</code>. +props.34.defaultValue = +props.34.since = 3.9.0 props.34.configurationSource = User properties -props.35.key = maven.style.project +props.35.key = maven.resolver.dependencyManagerTransitivity props.35.configurationType = String -props.35.description = Color style for project messages. -props.35.defaultValue = f:cyan +props.35.description = User property for selecting dependency manager behaviour regarding transitive dependencies and dependency management entries in their POMs. Maven 3 targeted full backward compatibility with Maven2, hence it ignored dependency management entries in transitive dependency POMs. Maven 4 enables "transitivity" by default, hence unlike Maven2, obeys dependency management entries deep in dependency graph as well. <br/> Default: <code>"true"</code>. +props.35.defaultValue = true props.35.since = 4.0.0 props.35.configurationSource = User properties -props.36.key = maven.style.strong +props.36.key = maven.resolver.transport props.36.configurationType = String -props.36.description = Color style for strong messages. -props.36.defaultValue = bold +props.36.description = Resolver transport to use. Can be <code>default</code>, <code>wagon</code>, <code>apache</code>, <code>jdk</code> or <code>auto</code>. +props.36.defaultValue = default props.36.since = 4.0.0 props.36.configurationSource = User properties -props.37.key = maven.style.success +props.37.key = maven.session.versionFilter props.37.configurationType = String -props.37.description = Color style for success messages. -props.37.defaultValue = bold,f:green +props.37.description = User property for version filter expression used in session, applied to resolving ranges: a semicolon separated list of filters to apply. By default, no version filter is applied (like in Maven 3). <br/> Supported filters: <ul> <li>"h" or "h(num)" - highest version or top list of highest ones filter</li> <li>"l" or "l(num)" - lowest version or bottom list of lowest ones filter</li> <li>"s" - contextual snapshot filter</li> <li>"e(G:A:V)" - predicate filter (leaves [...] +props.37.defaultValue = props.37.since = 4.0.0 props.37.configurationSource = User properties -props.38.key = maven.style.trace +props.38.key = maven.settings.security props.38.configurationType = String -props.38.description = Color style for trace messages. -props.38.defaultValue = bold,f:magenta -props.38.since = 4.0.0 +props.38.description = +props.38.defaultValue = ${maven.user.conf}/settings-security4.xml props.38.configurationSource = User properties -props.39.key = maven.style.transfer -props.39.configurationType = String -props.39.description = Color style for transfer messages. -props.39.defaultValue = f:bright-black +props.39.key = maven.startInstant +props.39.configurationType = java.time.Instant +props.39.description = User property used to store the build timestamp. +props.39.defaultValue = props.39.since = 4.0.0 props.39.configurationSource = User properties -props.40.key = maven.style.warning +props.40.key = maven.style.color props.40.configurationType = String -props.40.description = Color style for warning messages. -props.40.defaultValue = bold,f:yellow +props.40.description = Maven output color mode. Allowed values are <code>auto</code>, <code>always</code>, <code>never</code>. +props.40.defaultValue = auto props.40.since = 4.0.0 props.40.configurationSource = User properties -props.41.key = maven.user.conf +props.41.key = maven.style.debug props.41.configurationType = String -props.41.description = Maven user configuration directory. -props.41.defaultValue = ${user.home}/.m2 +props.41.description = Color style for debug messages. +props.41.defaultValue = bold,f:cyan props.41.since = 4.0.0 props.41.configurationSource = User properties -props.42.key = maven.user.extensions +props.42.key = maven.style.error props.42.configurationType = String -props.42.description = Maven user extensions. -props.42.defaultValue = ${maven.user.conf}/extensions.xml +props.42.description = Color style for error messages. +props.42.defaultValue = bold,f:red props.42.since = 4.0.0 props.42.configurationSource = User properties -props.43.key = maven.user.settings +props.43.key = maven.style.failure props.43.configurationType = String -props.43.description = Maven user settings. -props.43.defaultValue = ${maven.user.conf}/settings.xml +props.43.description = Color style for failure messages. +props.43.defaultValue = bold,f:red props.43.since = 4.0.0 props.43.configurationSource = User properties -props.44.key = maven.user.toolchains +props.44.key = maven.style.info props.44.configurationType = String -props.44.description = Maven user toolchains. -props.44.defaultValue = ${maven.user.conf}/toolchains.xml +props.44.description = Color style for info messages. +props.44.defaultValue = bold,f:blue props.44.since = 4.0.0 props.44.configurationSource = User properties -props.45.key = maven.versionResolver.noCache -props.45.configurationType = Boolean -props.45.description = User property for disabling version resolver cache. -props.45.defaultValue = false -props.45.since = 3.0.0 +props.45.key = maven.style.mojo +props.45.configurationType = String +props.45.description = Color style for mojo messages. +props.45.defaultValue = f:green +props.45.since = 4.0.0 props.45.configurationSource = User properties +props.46.key = maven.style.project +props.46.configurationType = String +props.46.description = Color style for project messages. +props.46.defaultValue = f:cyan +props.46.since = 4.0.0 +props.46.configurationSource = User properties +props.47.key = maven.style.strong +props.47.configurationType = String +props.47.description = Color style for strong messages. +props.47.defaultValue = bold +props.47.since = 4.0.0 +props.47.configurationSource = User properties +props.48.key = maven.style.success +props.48.configurationType = String +props.48.description = Color style for success messages. +props.48.defaultValue = bold,f:green +props.48.since = 4.0.0 +props.48.configurationSource = User properties +props.49.key = maven.style.trace +props.49.configurationType = String +props.49.description = Color style for trace messages. +props.49.defaultValue = bold,f:magenta +props.49.since = 4.0.0 +props.49.configurationSource = User properties +props.50.key = maven.style.transfer +props.50.configurationType = String +props.50.description = Color style for transfer messages. +props.50.defaultValue = f:bright-black +props.50.since = 4.0.0 +props.50.configurationSource = User properties +props.51.key = maven.style.warning +props.51.configurationType = String +props.51.description = Color style for warning messages. +props.51.defaultValue = bold,f:yellow +props.51.since = 4.0.0 +props.51.configurationSource = User properties +props.52.key = maven.user.conf +props.52.configurationType = String +props.52.description = Maven user configuration directory. +props.52.defaultValue = ${user.home}/.m2 +props.52.since = 4.0.0 +props.52.configurationSource = User properties +props.53.key = maven.user.extensions +props.53.configurationType = String +props.53.description = Maven user extensions. +props.53.defaultValue = ${maven.user.conf}/extensions.xml +props.53.since = 4.0.0 +props.53.configurationSource = User properties +props.54.key = maven.user.settings +props.54.configurationType = String +props.54.description = Maven user settings. +props.54.defaultValue = ${maven.user.conf}/settings.xml +props.54.since = 4.0.0 +props.54.configurationSource = User properties +props.55.key = maven.user.toolchains +props.55.configurationType = String +props.55.description = Maven user toolchains. +props.55.defaultValue = ${maven.user.conf}/toolchains.xml +props.55.since = 4.0.0 +props.55.configurationSource = User properties +props.56.key = maven.versionResolver.noCache +props.56.configurationType = Boolean +props.56.description = User property for disabling version resolver cache. +props.56.defaultValue = false +props.56.since = 3.0.0 +props.56.configurationSource = User properties diff --git a/src/site/markdown/configuration.yaml b/src/site/markdown/configuration.yaml index 4c95171e7a..5071b37498 100644 --- a/src/site/markdown/configuration.yaml +++ b/src/site/markdown/configuration.yaml @@ -76,6 +76,72 @@ props: defaultValue: ${maven.installation.conf}/toolchains.xml since: 4.0.0 configurationSource: User properties + - key: maven.logger.cacheOutputStream + configurationType: Boolean + description: "If the output target is set to \"System.out\" or \"System.err\" (see preceding entry), by default, logs will be output to the latest value referenced by System.out/err variables. By setting this parameter to true, the output stream will be cached, i.e. assigned once at initialization time and re-used independently of the current value referenced by System.out/err." + defaultValue: false + since: 4.0.0 + configurationSource: User properties + - key: maven.logger.dateTimeFormat + configurationType: String + description: "The date and time format to be used in the output messages. The pattern describing the date and time format is defined by SimpleDateFormat. If the format is not specified or is invalid, the number of milliseconds since start up will be output." + defaultValue: + since: 4.0.0 + configurationSource: User properties + - key: maven.logger.defaultLogLevel + configurationType: String + description: "Default log level for all instances of SimpleLogger. Must be one of (\"trace\", \"debug\", \"info\", \"warn\", \"error\" or \"off\"). If not specified, defaults to \"info\"." + defaultValue: + since: 4.0.0 + configurationSource: User properties + - key: maven.logger.levelInBrackets + configurationType: Boolean + description: "Should the level string be output in brackets? Defaults to false." + defaultValue: false + since: 4.0.0 + configurationSource: User properties + - key: maven.logger.logFile + configurationType: String + description: "The output target which can be the path to a file, or the special values \"System.out\" and \"System.err\". Default is \"System.err\"." + defaultValue: + since: 4.0.0 + configurationSource: User properties + - key: maven.logger.showDateTime + configurationType: Boolean + description: "Set to true if you want the current date and time to be included in output messages. Default is false." + defaultValue: false + since: 4.0.0 + configurationSource: User properties + - key: maven.logger.showLogName + configurationType: Boolean + description: "Set to true if you want the Logger instance name to be included in output messages. Defaults to true." + defaultValue: true + since: 4.0.0 + configurationSource: User properties + - key: maven.logger.showShortLogName + configurationType: Boolean + description: "Set to true if you want the last component of the name to be included in output messages. Defaults to false." + defaultValue: false + since: 4.0.0 + configurationSource: User properties + - key: maven.logger.showThreadId + configurationType: Boolean + description: "If you would like to output the current thread id, then set to true. Defaults to false." + defaultValue: false + since: 4.0.0 + configurationSource: User properties + - key: maven.logger.showThreadName + configurationType: Boolean + description: "Set to true if you want to output the current thread name. Defaults to true." + defaultValue: true + since: 4.0.0 + configurationSource: User properties + - key: maven.logger.warnLevelString + configurationType: String + description: "The string value output for the warn level. Defaults to WARN." + defaultValue: WARN + since: 4.0.0 + configurationSource: User properties - key: maven.modelBuilder.parallelism configurationType: Integer description: "ProjectBuilder parallelism." diff --git a/src/site/markdown/maven-configuration.md b/src/site/markdown/maven-configuration.md index aa7a04b76f..b886334642 100644 --- a/src/site/markdown/maven-configuration.md +++ b/src/site/markdown/maven-configuration.md @@ -35,6 +35,17 @@ under the License. | `maven.installation.extensions` | `String` | Maven installation extensions. | `${maven.installation.conf}/extensions.xml` | 4.0.0 | User properties | | `maven.installation.settings` | `String` | Maven installation settings. | `${maven.installation.conf}/settings.xml` | 4.0.0 | User properties | | `maven.installation.toolchains` | `String` | Maven installation toolchains. | `${maven.installation.conf}/toolchains.xml` | 4.0.0 | User properties | +| `maven.logger.cacheOutputStream` | `Boolean` | If the output target is set to "System.out" or "System.err" (see preceding entry), by default, logs will be output to the latest value referenced by System.out/err variables. By setting this parameter to true, the output stream will be cached, i.e. assigned once at initialization time and re-used independently of the current value referenced by System.out/err. | `false` | 4.0.0 | User properties | +| `maven.logger.dateTimeFormat` | `String` | The date and time format to be used in the output messages. The pattern describing the date and time format is defined by SimpleDateFormat. If the format is not specified or is invalid, the number of milliseconds since start up will be output. | - | 4.0.0 | User properties | +| `maven.logger.defaultLogLevel` | `String` | Default log level for all instances of SimpleLogger. Must be one of ("trace", "debug", "info", "warn", "error" or "off"). If not specified, defaults to "info". | - | 4.0.0 | User properties | +| `maven.logger.levelInBrackets` | `Boolean` | Should the level string be output in brackets? Defaults to false. | `false` | 4.0.0 | User properties | +| `maven.logger.logFile` | `String` | The output target which can be the path to a file, or the special values "System.out" and "System.err". Default is "System.err". | - | 4.0.0 | User properties | +| `maven.logger.showDateTime` | `Boolean` | Set to true if you want the current date and time to be included in output messages. Default is false. | `false` | 4.0.0 | User properties | +| `maven.logger.showLogName` | `Boolean` | Set to true if you want the Logger instance name to be included in output messages. Defaults to true. | `true` | 4.0.0 | User properties | +| `maven.logger.showShortLogName` | `Boolean` | Set to true if you want the last component of the name to be included in output messages. Defaults to false. | `false` | 4.0.0 | User properties | +| `maven.logger.showThreadId` | `Boolean` | If you would like to output the current thread id, then set to true. Defaults to false. | `false` | 4.0.0 | User properties | +| `maven.logger.showThreadName` | `Boolean` | Set to true if you want to output the current thread name. Defaults to true. | `true` | 4.0.0 | User properties | +| `maven.logger.warnLevelString` | `String` | The string value output for the warn level. Defaults to WARN. | `WARN` | 4.0.0 | User properties | | `maven.modelBuilder.parallelism` | `Integer` | ProjectBuilder parallelism. | `cores/2 + 1` | 4.0.0 | User properties | | `maven.plugin.validation` | `String` | Plugin validation level. | `inline` | 3.9.2 | User properties | | `maven.plugin.validation.excludes` | `String` | Plugin validation exclusions. | - | 3.9.6 | User properties |