[logging-log4j2] branch master updated: LOG4J2-3242 - Move JNDI to its own module. Require a system property to enable JNDI features. Limit JNDI to the java protocol
This is an automated email from the ASF dual-hosted git repository. rgoers pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git The following commit(s) were added to refs/heads/master by this push: new 14e307a LOG4J2-3242 - Move JNDI to its own module. Require a system property to enable JNDI features. Limit JNDI to the java protocol 14e307a is described below commit 14e307ac825f9c169f8c14203c680564d1943ac2 Author: Ralph Goers AuthorDate: Fri Dec 24 22:12:23 2021 -0700 LOG4J2-3242 - Move JNDI to its own module. Require a system property to enable JNDI features. Limit JNDI to the java protocol --- .../org/apache/logging/log4j/util/Constants.java | 19 +++ log4j-core/pom.xml | 5 - .../logging/log4j/core/lookup/Interpolator.java| 32 ++--- .../log4j/core/lookup/InterpolatorTest.java| 31 ++-- log4j-core/src/test/java9/module-info.java | 1 - log4j-jms/pom.xml | 4 + .../logging/log4j/jms/appender/JmsAppender.java| 41 +- .../logging/log4j/jms/appender/JmsManager.java | 2 +- .../log4j/jms/appender/JmsAppenderTest.java| 2 +- {log4j-jms => log4j-jndi}/pom.xml | 94 ++-- .../apache/logging/log4j/jndi}/JndiManager.java| 160 + .../logging/log4j/jndi}/lookup/JndiLookup.java | 15 +- .../log4j/jndi}/selector/JndiContextSelector.java | 8 +- .../logging/log4j/jndi}/util/JndiCloser.java | 126 log4j-jndi/src/site/manual/index.md| 33 + log4j-jndi/src/site/site.xml | 52 +++ .../apache/logging/log4j/jndi/JndiManagerTest.java | 64 + .../routing/RoutingAppenderWithJndiTest.java | 16 +-- .../log4j/jndi}/lookup/InterpolatorTest.java | 18 ++- .../log4j/jndi}/lookup/JndiDisabledLookupTest.java | 5 +- .../logging/log4j/jndi}/lookup/JndiExploit.java| 2 +- .../logging/log4j/jndi}/lookup/JndiLookupTest.java | 5 +- .../jndi}/lookup/JndiRestrictedLookupTest.java | 36 + .../src/test/resources/JndiRestrictedLookup.ldif | 0 .../src/test/resources/log4j-routing-by-jndi.xml | 0 pom.xml| 6 + src/changes/changes.xml| 10 +- 27 files changed, 418 insertions(+), 369 deletions(-) diff --git a/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java b/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java index 06c462d..8308f93 100644 --- a/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java +++ b/log4j-api/src/main/java/org/apache/logging/log4j/util/Constants.java @@ -22,6 +22,9 @@ package org.apache.logging.log4j.util; * @since 2.6.2 */ public final class Constants { + +public static final String JNDI_PREFIX = "log4j2.enableJndi"; +private static final String JNDI_MANAGER_CLASS = "org.apache.logging.log4j.jndi.JndiManager"; /** * {@code true} if we think we are running in a web container, based on the boolean value of system property * "log4j2.is.webapp", or (if this system property is not set) whether the {@code javax.servlet.Servlet} class @@ -32,6 +35,22 @@ public final class Constants { || isClassAvailable("jakarta.servlet.Servlet")); /** + * Check to determine if the JNDI feature is available. + * @param subKey The feature to check. + * @return true if the feature is available. + */ +private static boolean isJndiEnabled(final String subKey) { +return PropertiesUtil.getProperties().getBooleanProperty(JNDI_PREFIX + subKey, false) +&& isClassAvailable(JNDI_MANAGER_CLASS); +} + +public static boolean JNDI_CONTEXT_SELECTOR_ENABLED = isJndiEnabled("ContextSelector"); + +public static boolean JNDI_JMS_ENABLED = isJndiEnabled("Jms"); + +public static boolean JNDI_LOOKUP_ENABLED = isJndiEnabled("Lookup"); + +/** * Kill switch for object pooling in ThreadLocals that enables much of the LOG4J2-1270 no-GC behaviour. * * {@code True} for non-{@link #IS_WEB_APP web apps}, disable by setting system property diff --git a/log4j-core/pom.xml b/log4j-core/pom.xml index b549995..e28fb71 100644 --- a/log4j-core/pom.xml +++ b/log4j-core/pom.xml @@ -311,11 +311,6 @@ - - org.zapodot - embedded-ldap-junit - test - diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java index 0713017..bdf8bd9 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java @@ -24,7 +24,6 @@ import java.util.Map; import org.apache.logging.log4j.
[logging-log4j2] branch release-2.x updated: [DOC] Fix copy-paste error in migration page
This is an automated email from the ASF dual-hosted git repository. rpopma pushed a commit to branch release-2.x in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git The following commit(s) were added to refs/heads/release-2.x by this push: new 06fa8d8 [DOC] Fix copy-paste error in migration page 06fa8d8 is described below commit 06fa8d882582e0f8045d3ff4e31e55f6801b83a2 Author: rpopma AuthorDate: Sat Dec 25 13:08:16 2021 +0900 [DOC] Fix copy-paste error in migration page --- src/site/xdoc/manual/migration.xml | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/site/xdoc/manual/migration.xml b/src/site/xdoc/manual/migration.xml index e976a76..c769bf3 100644 --- a/src/site/xdoc/manual/migration.xml +++ b/src/site/xdoc/manual/migration.xml @@ -95,7 +95,10 @@ -For the most part, converting from the Log4j 1.x API to Log4j 2 should be fairly simple. Many + + The other migration option involves changing your application code to use + the Log4j 2 API. + For the most part, converting from the Log4j 1.x API to Log4j 2 should be fairly simple. Many of the log statements will require no modification. However, where necessary the following changes must be made. @@ -165,8 +168,6 @@ - The other migration option involves changing your application code to use - the Log4j 2 API. Although the Log4j 2 configuration syntax is different than that of Log4j 1.x, most, if not all, of the same functionality is available.
[logging-log4j-site] branch asf-staging updated: Fix copy-paste error in migration page
This is an automated email from the ASF dual-hosted git repository. rpopma pushed a commit to branch asf-staging in repository https://gitbox.apache.org/repos/asf/logging-log4j-site.git The following commit(s) were added to refs/heads/asf-staging by this push: new d49b47e Fix copy-paste error in migration page d49b47e is described below commit d49b47e68abdc073368740ebd47913b52992c5d4 Author: Remko Popma AuthorDate: Sat Dec 25 13:07:50 2021 +0900 Fix copy-paste error in migration page --- log4j-2.17.0/manual/migration.html | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/log4j-2.17.0/manual/migration.html b/log4j-2.17.0/manual/migration.html index 376a9d5..a3194a0 100644 --- a/log4j-2.17.0/manual/migration.html +++ b/log4j-2.17.0/manual/migration.html @@ -237,7 +237,10 @@ Option 2: convert your application to the Log4j 2 API (log4j-api) - For the most part, converting from the Log4j 1.x API to Log4j 2 should be fairly simple. Many + + The other migration option involves changing your application code to use + the Log4j 2 API. + For the most part, converting from the Log4j 1.x API to Log4j 2 should be fairly simple. Many of the log statements will require no modification. However, where necessary the following changes must be made. @@ -344,8 +347,6 @@ Migrating logging configurations to the Log4j 2 format - The other migration option involves changing your application code to use - the Log4j 2 API. Although the Log4j 2 configuration syntax is different than that of Log4j 1.x, most, if not all, of the same functionality is available. @@ -644,6 +645,7 @@ +
[logging-log4j-site] branch asf-staging updated: Add images to migration page
This is an automated email from the ASF dual-hosted git repository. rpopma pushed a commit to branch asf-staging in repository https://gitbox.apache.org/repos/asf/logging-log4j-site.git The following commit(s) were added to refs/heads/asf-staging by this push: new 6caea77 Add images to migration page 6caea77 is described below commit 6caea774eccc15a944bd9fb7cc5ef55e05aa61ae Author: Remko Popma AuthorDate: Sat Dec 25 13:04:38 2021 +0900 Add images to migration page --- log4j-2.17.0/images/whichjar-log4j-1.2-api.png | Bin 0 -> 24992 bytes log4j-2.17.0/images/whichjar-log4j-api.png | Bin 0 -> 16515 bytes log4j-2.17.0/manual/migration.html | 11 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/log4j-2.17.0/images/whichjar-log4j-1.2-api.png b/log4j-2.17.0/images/whichjar-log4j-1.2-api.png new file mode 100644 index 000..8b54810 Binary files /dev/null and b/log4j-2.17.0/images/whichjar-log4j-1.2-api.png differ diff --git a/log4j-2.17.0/images/whichjar-log4j-api.png b/log4j-2.17.0/images/whichjar-log4j-api.png new file mode 100644 index 000..194196a Binary files /dev/null and b/log4j-2.17.0/images/whichjar-log4j-api.png differ diff --git a/log4j-2.17.0/manual/migration.html b/log4j-2.17.0/manual/migration.html index 7b62356..376a9d5 100644 --- a/log4j-2.17.0/manual/migration.html +++ b/log4j-2.17.0/manual/migration.html @@ -182,6 +182,8 @@ the Log4j 1.x bridge jar (log4j-1.2-api.jar). + + For most applications this is sufficient. This is a low-effort way to migrate, and may also allow for migration to proceed gradually over time. @@ -235,13 +237,12 @@ Option 2: convert your application to the Log4j 2 API (log4j-api) - - The other migration option involves changing your application code to use - the Log4j 2 API. - For the most part, converting from the Log4j 1.x API to Log4j 2 should be fairly simple. Many + For the most part, converting from the Log4j 1.x API to Log4j 2 should be fairly simple. Many of the log statements will require no modification. However, where necessary the following changes must be made. + + @@ -343,6 +344,8 @@ Migrating logging configurations to the Log4j 2 format + The other migration option involves changing your application code to use + the Log4j 2 API. Although the Log4j 2 configuration syntax is different than that of Log4j 1.x, most, if not all, of the same functionality is available.
[logging-log4j2] branch release-2.x updated: [DOC] Add images to migration page
This is an automated email from the ASF dual-hosted git repository. rpopma pushed a commit to branch release-2.x in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git The following commit(s) were added to refs/heads/release-2.x by this push: new 00de3eb [DOC] Add images to migration page 00de3eb is described below commit 00de3ebfe17ab3868985793f9c6a107808236dfc Author: rpopma AuthorDate: Sat Dec 25 13:04:03 2021 +0900 [DOC] Add images to migration page --- .../resources/images/whichjar-log4j-1.2-api.png | Bin 0 -> 24992 bytes src/site/resources/images/whichjar-log4j-api.png| Bin 0 -> 16515 bytes src/site/resources/images/whichjar.xlsx | Bin 14681 -> 21234 bytes src/site/xdoc/manual/migration.xml | 2 ++ 4 files changed, 2 insertions(+) diff --git a/src/site/resources/images/whichjar-log4j-1.2-api.png b/src/site/resources/images/whichjar-log4j-1.2-api.png new file mode 100644 index 000..8b54810 Binary files /dev/null and b/src/site/resources/images/whichjar-log4j-1.2-api.png differ diff --git a/src/site/resources/images/whichjar-log4j-api.png b/src/site/resources/images/whichjar-log4j-api.png new file mode 100644 index 000..194196a Binary files /dev/null and b/src/site/resources/images/whichjar-log4j-api.png differ diff --git a/src/site/resources/images/whichjar.xlsx b/src/site/resources/images/whichjar.xlsx index 6847bca..8d042a1 100644 Binary files a/src/site/resources/images/whichjar.xlsx and b/src/site/resources/images/whichjar.xlsx differ diff --git a/src/site/xdoc/manual/migration.xml b/src/site/xdoc/manual/migration.xml index b588e10..e976a76 100644 --- a/src/site/xdoc/manual/migration.xml +++ b/src/site/xdoc/manual/migration.xml @@ -53,6 +53,7 @@ the Log4j 2 implementation jar (log4j-core.jar) and the Log4j 1.x bridge jar (log4j-1.2-api.jar). + For most applications this is sufficient. This is a low-effort way to migrate, and may also allow for migration to proceed gradually over time. @@ -97,6 +98,7 @@ For the most part, converting from the Log4j 1.x API to Log4j 2 should be fairly simple. Many of the log statements will require no modification. However, where necessary the following changes must be made. + Log4j 1.x
[logging-log4j2] branch release-2.x updated: [DOC] Small migration page improvement
This is an automated email from the ASF dual-hosted git repository. rpopma pushed a commit to branch release-2.x in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git The following commit(s) were added to refs/heads/release-2.x by this push: new 71d7634 [DOC] Small migration page improvement 71d7634 is described below commit 71d7634fcb3294024322eeb73c08311bcf5e3f41 Author: rpopma AuthorDate: Sat Dec 25 12:20:15 2021 +0900 [DOC] Small migration page improvement --- src/site/xdoc/manual/migration.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/site/xdoc/manual/migration.xml b/src/site/xdoc/manual/migration.xml index 3152f38..b588e10 100644 --- a/src/site/xdoc/manual/migration.xml +++ b/src/site/xdoc/manual/migration.xml @@ -163,6 +163,8 @@ + The other migration option involves changing your application code to use + the Log4j 2 API. Although the Log4j 2 configuration syntax is different than that of Log4j 1.x, most, if not all, of the same functionality is available.
[logging-log4j-site] branch asf-staging updated: Small migration page improvement
This is an automated email from the ASF dual-hosted git repository. rpopma pushed a commit to branch asf-staging in repository https://gitbox.apache.org/repos/asf/logging-log4j-site.git The following commit(s) were added to refs/heads/asf-staging by this push: new 0102cbf Small migration page improvement 0102cbf is described below commit 0102cbf580c2398b49bd682369c75cd554df7078 Author: Remko Popma AuthorDate: Sat Dec 25 12:19:45 2021 +0900 Small migration page improvement --- log4j-2.17.0/manual/migration.html | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/log4j-2.17.0/manual/migration.html b/log4j-2.17.0/manual/migration.html index ed7c8b5..7b62356 100644 --- a/log4j-2.17.0/manual/migration.html +++ b/log4j-2.17.0/manual/migration.html @@ -235,7 +235,10 @@ Option 2: convert your application to the Log4j 2 API (log4j-api) - For the most part, converting from the Log4j 1.x API to Log4j 2 should be fairly simple. Many + + The other migration option involves changing your application code to use + the Log4j 2 API. + For the most part, converting from the Log4j 1.x API to Log4j 2 should be fairly simple. Many of the log statements will require no modification. However, where necessary the following changes must be made.
[logging-log4j2] branch release-2.x updated: [DOC] improve migration page
This is an automated email from the ASF dual-hosted git repository. rpopma pushed a commit to branch release-2.x in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git The following commit(s) were added to refs/heads/release-2.x by this push: new 8327aff [DOC] improve migration page 8327aff is described below commit 8327affdaca05e2b94615af661e2229cd1537fa6 Author: rpopma AuthorDate: Sat Dec 25 11:55:59 2021 +0900 [DOC] improve migration page * re-order some sections * put existing text in subsections for clarity * use table instead of bullet list for API conversion steps * many small changes --- src/site/xdoc/manual/migration.xml | 194 +++-- 1 file changed, 123 insertions(+), 71 deletions(-) diff --git a/src/site/xdoc/manual/migration.xml b/src/site/xdoc/manual/migration.xml index 7c573a0..3152f38 100644 --- a/src/site/xdoc/manual/migration.xml +++ b/src/site/xdoc/manual/migration.xml @@ -25,65 +25,108 @@ - + + +This page explains how to migrate applications or libraries currently using the Log4j 1.x API +to use Log4j v2 as their main logging framework. + - + - This bridge is useful as a dependency of an "application" which would like to use Log4j v2 as its main logging framework, if either that application itself hasn't been changed from using the Log4j 1.x API to the 1.x API, or if such an application depends on one or several (perhaps old) libraries that are "out of your control", and which themselves still contain code and thus a compile dependency on Log 1.x only. + You may be able to convert an application to Log4j 2 without any code changes + by replacing the Log4j 1.x jar file with Log4j 2's log4j-1.2-api.jar. - Once you have migrated all of your own application & library code under your control, you may not need this bridge. - Note that when you use a library/framework that can be configured to use several logging frameworks, then you typically don't need this bridge either anymore, as you may be able to directly configure it to use Log4j v2 instead v1. - Some libraries/frameworks even auto-detect the presence of certain logging framework implementations on their classpath, and automagically switch their internal logging delegation accordingly; try simple removing the Log4j v1 dependency instead of replacing it with this bridge, and test if logging from all of your dependencies still work. + The Log4j 1.x bridge is useful when: + + the application itself is (maybe partly) still using the Log4j 1.x API, or if + + the application depends on a library which depends on the Log 1.x API, or + +the application needs to support logging configurations in the old Log4j 1.x format. + + - If you own or can contribute open source to the library you depend on, then you likely would prefer replacing its use of the Log4j v1 Logging API with the v2 API. - (It typically does not make sense for libraries to depend on this bridge and support both the v1 and v2 Log4j API, because end-users of such a library would still have to replace their Log4j configuration v1 with a different v2 config anyway; see below.) + To use this option, applications need to use the following three jar files: + the Log4j 2 API jar (log4j-api.jar), + the Log4j 2 implementation jar (log4j-core.jar) and + the Log4j 1.x bridge jar (log4j-1.2-api.jar). - - - Perhaps the simplest way to convert to using Log4j 2 is to replace the log4j 1.x jar file with - Log4j 2's log4j-1.2-api.jar. However, to use this successfully applications must meet the - following requirements: + For most applications this is sufficient. + This is a low-effort way to migrate, and may also allow for migration to proceed gradually over time. + + +Limitations of the Log4j 1.x bridge + + Applications can migrate by just using the bridge without further code changes, + if they meet the following requirements: + + + They must not access methods and classes internal to the Log4j 1.x implementation such +as Appenders, LoggerRepository or Category's +callAppenders method. + They must not programmatically configure Log4j. + They must not configure by calling the Log4j 1.x classes DOMConfigurator or +PropertyConfigurator. + + +
[logging-log4j2] branch release-2.x updated: Fix generics warning.
This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch release-2.x in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git The following commit(s) were added to refs/heads/release-2.x by this push: new eab9089 Fix generics warning. eab9089 is described below commit eab90893c48708ba4941b34361a2980d071c2906 Author: Gary Gregory AuthorDate: Fri Dec 24 18:11:50 2021 -0500 Fix generics warning. --- .../main/java/org/apache/log4j/config/PropertiesConfiguration.java | 5 +++-- .../main/java/org/apache/log4j/helpers/AppenderAttachableImpl.java | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/config/PropertiesConfiguration.java b/log4j-1.2-api/src/main/java/org/apache/log4j/config/PropertiesConfiguration.java index 928f883..8b9b3b9 100644 --- a/log4j-1.2-api/src/main/java/org/apache/log4j/config/PropertiesConfiguration.java +++ b/log4j-1.2-api/src/main/java/org/apache/log4j/config/PropertiesConfiguration.java @@ -24,6 +24,7 @@ import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Properties; import java.util.SortedMap; import java.util.StringTokenizer; @@ -330,9 +331,9 @@ public class PropertiesConfiguration extends Log4j1Configuration { * Parse non-root elements, such non-root categories and renderers. */ private void parseLoggers(Properties props) { -Enumeration enumeration = props.propertyNames(); +Enumeration enumeration = props.propertyNames(); while (enumeration.hasMoreElements()) { -String key = (String) enumeration.nextElement(); +String key = Objects.toString(enumeration.nextElement(), null); if (key.startsWith(CATEGORY_PREFIX) || key.startsWith(LOGGER_PREFIX)) { String loggerName = null; if (key.startsWith(CATEGORY_PREFIX)) { diff --git a/log4j-1.2-api/src/main/java/org/apache/log4j/helpers/AppenderAttachableImpl.java b/log4j-1.2-api/src/main/java/org/apache/log4j/helpers/AppenderAttachableImpl.java index 4d6aecd..b6e9f61 100644 --- a/log4j-1.2-api/src/main/java/org/apache/log4j/helpers/AppenderAttachableImpl.java +++ b/log4j-1.2-api/src/main/java/org/apache/log4j/helpers/AppenderAttachableImpl.java @@ -40,7 +40,7 @@ public class AppenderAttachableImpl implements AppenderAttachable { } @Override -public Enumeration getAllAppenders() { +public Enumeration getAllAppenders() { return Collections.enumeration(appenders.values()); }
[logging-log4j2] branch release-2.x updated: Add tables to map CVEs to Log4j and Java versions.
This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch release-2.x in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git The following commit(s) were added to refs/heads/release-2.x by this push: new 0286bb1 Add tables to map CVEs to Log4j and Java versions. new efb76dc Merge branch 'release-2.x' of https://gitbox.apache.org/repos/asf/logging-log4j2.git into release-2.x 0286bb1 is described below commit 0286bb1872ccbc2fac855c7eb9bc4feb1d90557b Author: Gary Gregory AuthorDate: Fri Dec 24 17:16:40 2021 -0500 Add tables to map CVEs to Log4j and Java versions. --- docs/cve-map.md | 15 +++ 1 file changed, 15 insertions(+) diff --git a/docs/cve-map.md b/docs/cve-map.md new file mode 100644 index 000..3d06cb7 --- /dev/null +++ b/docs/cve-map.md @@ -0,0 +1,15 @@ +This is a map of CVEs and Log4j *2* Versions. + +| CVE| Affects | Fixed In | Java Required | +| -- | - | --- | --- | +| CVE-2021-45105 | 2.0-beta9 to 2.16.0, excluding 2.12.3 | 2.17.02.12.32.3.1 | Java 8Java 7Java 6 | +| CVE-2021-45046 | 2.0-beta9 to 2.15.0, excluding 2.12.2 | 2.16.02.12.22.3.1 | Java 8Java 7Java 6 | +| CVE-2021-44228 | 2.0-beta9 to 2.16.0, excluding 2.12.3 & 2.3.1 | 2.17.02.12.32.3.1 | Java 8Java 7Java 6 | +| CVE-2020-9488 | 2.0-alpha1 to 2.13.1 | 2.13.22.12.3 | Java 8Java 7 | +| CVE-2017-5645 | 2.0-alpha1 to 2.8.1 | 2.8.2 | Java 7 | + +This is a map of CVEs and Log4j *1* End-of-Life Versions. + +| CVE| Affects | Fixed In | Java Required | +| -- | - | --- | --- | +| CVE-2019-17571 | 1.2 to 1.2.17 | Not fixed | Not fixed |
[logging-log4j2] branch release-2.x updated: Removed dead sonar link
This is an automated email from the ASF dual-hosted git repository. rmiddleton pushed a commit to branch release-2.x in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git The following commit(s) were added to refs/heads/release-2.x by this push: new 7b339de Removed dead sonar link 7b339de is described below commit 7b339de3bc63bdaae0e702b570bcf1a1d0d90116 Author: Robert Middleton AuthorDate: Fri Dec 24 16:07:13 2021 -0500 Removed dead sonar link --- src/site/site.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/site/site.xml b/src/site/site.xml index 6cb90a4..c95bcfc 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -38,7 +38,6 @@ https://cwiki.apache.org/confluence/display/LOGGING/Log4j"/> https://www.apache.org/"/> https://logging.apache.org/"/> - https://analysis.apache.org/dashboard/index/org.apache.logging.log4j:log4j"/> https://github.com/apache/logging-log4j2"/>
[logging-log4j2] branch api-separation-documentation updated: Added documentation on how to use Log4j2 as Log4j1 backend
This is an automated email from the ASF dual-hosted git repository. rmiddleton pushed a commit to branch api-separation-documentation in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git The following commit(s) were added to refs/heads/api-separation-documentation by this push: new 7ffa589 Added documentation on how to use Log4j2 as Log4j1 backend 7ffa589 is described below commit 7ffa589f3b9a237d3ffb7a1387b548d08b4baa3b Author: Robert Middleton AuthorDate: Fri Dec 24 16:02:48 2021 -0500 Added documentation on how to use Log4j2 as Log4j1 backend --- src/site/markdown/api-separation.md | 42 +++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/src/site/markdown/api-separation.md b/src/site/markdown/api-separation.md index 5ad6ee8..08aef37 100644 --- a/src/site/markdown/api-separation.md +++ b/src/site/markdown/api-separation.md @@ -127,7 +127,7 @@ import org.slf4j.LoggerFactory; public class Log4j2Test { -protected static final Logger logger = LoggerFactory.getLogger(Log4j2Test.class); +private static final Logger logger = LoggerFactory.getLogger(Log4j2Test.class); public Log4j2Test(){ logger.info( "Hello World!" ); @@ -168,7 +168,7 @@ import java.util.logging.Logger; public class Log4j2Test { -protected static final Logger logger = Logger.getLogger(Log4j2Test.class.getName()); +private static final Logger logger = Logger.getLogger(Log4j2Test.class.getName()); public Log4j2Test(){ logger.info( "Hello World!" ); @@ -195,6 +195,44 @@ In order to route these messages to Log4j2, your dependencies would look like th ``` +## Using Log4j2 as a backend for Log4j1 + +Some software may still depend on Log4j1, and in that case it may be infeasible +to upgrade to Log4j2. Assuming that our code looks like the following: + +```java +import org.apache.log4j.Logger; + +public class Log4j2Test { + +private static final Logger logger = Logger.getLogger(Log4j2Test.class); + +public Log4j2Test(){ +logger.info( "Hello World!" ); +} +} +``` + +we can then quickly and easily configure these messages to use Log4j2 +as the logging implementation by depending on the log4j-1.2-api like so: + +``` + +org.apache.logging.log4j +log4j-1.2-api +2.17.0 + + +org.apache.logging.log4j +log4j-core +2.17.0 + +``` + +There are some limitations to this, but it is expected to work for the +majority of common cases. See the (manual)[https://logging.apache.org/log4j/2.x/manual/compatibility.html] +for more information on this feature. + # Conclusion With the API separation that Lo4j2 provides, it is possible to use multiple
[logging-log4j2] 01/01: Added documentation on the API separation of Log4j2
This is an automated email from the ASF dual-hosted git repository. rmiddleton pushed a commit to branch api-separation-documentation in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git commit f8ccfe1c53d8ab0563485a4e619f061090c02b97 Author: Robert Middleton AuthorDate: Fri Dec 24 15:50:05 2021 -0500 Added documentation on the API separation of Log4j2 --- src/site/markdown/api-separation.md | 203 1 file changed, 203 insertions(+) diff --git a/src/site/markdown/api-separation.md b/src/site/markdown/api-separation.md new file mode 100644 index 000..5ad6ee8 --- /dev/null +++ b/src/site/markdown/api-separation.md @@ -0,0 +1,203 @@ + + + +# API Separation + +When selecting a logging library, some care must be taken in order to ensure +that multiple different logging libraries are properly accounted for. For +example, library code that you depend on may use slf4j, while other libraries +may simply use java.util.logging. All of these can be routed to the log4j +core in order to be logged. + +If however you want to use a different logging implementation(such as logback), +it is possible to route messages from the Log4j API to logback, ensuring that +your application is not tied to a specific logging framework. + +A typical class using the Log4j2 API looks like the following: + +```java +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +public class Log4j2Test { +private static final Logger logger = LogManager.getLogger(); + +public Log4j2Test(){ +logger.info( "Hello World!" ); +} +} +``` + +In order to use the API portion of Log4j2, we only need to provide a single +dependency, log4j-api. Using Maven, you would add the following to your +dependencies: + +``` + +org.apache.logging.log4j +log4j-api +2.17.0 + +``` + +## Using Log4j2 API and Core + +Using the Log4j2 API and Core together means that log messages will be routed +through the Log4j2 Core. The Log4j2 core is responsible for the +following(note: this is not an exhaustive list): + +* Configuration of the system(via an XML file for example) +* Routing messages to appenders +* Opening files and other resources for logs(e.g. network sockets) + +When using the Log4j2 core, this means that your config file must match the +[configuration](manual/configuration.html) used by Log4j2. + +To use both the API and the core, you would add the following to your +dependencies(assuming that you are using Maven): + +``` + +org.apache.logging.log4j +log4j-api +2.17.0 + + +org.apache.logging.log4j +log4j-core +2.17.0 + +``` + +Note that having two different versions of log4j-api and log4j-core on your +classpath is not guaranteed to work correctly(e.g. 2.15 of log4j-api and +2.17 of log4j-core). + +## Using Log4j2 API with Logback + +Since the Log4j2 API is generic, we can use it to send messages via SLF4J +and then have Logback do the actual logging of the messages. This means +that you can write your code tied to the Log4j2 API, but users of your +code do not need to use the Log4j2 core if they are already using Logback. + +To switch to using Logback, you will need to add the following to your +dependencies(assumging that you are using Maven): + +``` + +org.apache.logging.log4j +log4j-api +2.17.0 + + +org.apache.logging.log4j +log4j-to-slf4j +2.17.0 + + + ch.qos.logback + logback-classic + 1.2.10 + +``` + +## Using Log4j2 as an SLF4J Implementation + +If you don't want to depend on the Log4j2 API and instead want to use SLF4J, +that is possible as well. Assuming that our code looks like the following: + +```java +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class Log4j2Test { + +protected static final Logger logger = LoggerFactory.getLogger(Log4j2Test.class); + +public Log4j2Test(){ +logger.info( "Hello World!" ); +} +} +``` + +We can then route the messages to Log4j2 using the log4j-slf4j-impl like the following: + +``` + +org.slf4j +slf4j-api +1.7.32 + + + org.apache.logging.log4j + log4j-slf4j-impl + 2.17.0 + + +org.apache.logging.log4j +log4j-core +2.17.0 + +``` + +Note that if we were using SLF4J 1.8 instead of 1.7, that requires us to use +log4j-slf4j18-impl instead of log4j-slf4j-impl. + +## Using Log4j2 with JUL + +It is also possible to route messages that are logged using java.util.logging +to Log4j2. Assuming that the code looks like the following: + +```java +import java.util.logging.Logger; + +public class Log4j2Test { + +protected static final Logger logger = Logger.getLogger(Log4j2Test.class.getName()); + +public Log4j2Test(){ +logger.info( "Hello World!" ); +} +``` + +We can then also route these messages to the Log4j2 core by adding in the JUL bridge, +and setting the java.util.logging.manager property in the JVM(see the documentation on +[the JU
[logging-log4j2] branch api-separation-documentation created (now f8ccfe1)
This is an automated email from the ASF dual-hosted git repository. rmiddleton pushed a change to branch api-separation-documentation in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git. at f8ccfe1 Added documentation on the API separation of Log4j2 This branch includes the following new commits: new f8ccfe1 Added documentation on the API separation of Log4j2 The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
[logging-parent] branch master updated: define outputTimestamp for release to update
This is an automated email from the ASF dual-hosted git repository. mattsicker pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/logging-parent.git The following commit(s) were added to refs/heads/master by this push: new b2f7ccf define outputTimestamp for release to update new 9171152 Merge pull request #3 from hboutemy/patch-1 b2f7ccf is described below commit b2f7ccf83b609c28cb75d94ed50ee9c48f749301 Author: Hervé Boutemy AuthorDate: Fri Dec 24 16:03:15 2021 +0100 define outputTimestamp for release to update see https://issues.apache.org/jira/browse/MRELEASE-1071 bug --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d3e1b51..3b8f0f1 100644 --- a/pom.xml +++ b/pom.xml @@ -44,7 +44,7 @@ 1.8 1.8 -1 +10
[logging-log4j2] branch release-2.x updated: LOG4J2-3288 Interpolator non-plugin ctor includes all core lookups
This is an automated email from the ASF dual-hosted git repository. ckozak pushed a commit to branch release-2.x in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git The following commit(s) were added to refs/heads/release-2.x by this push: new 68fdfce LOG4J2-3288 Interpolator non-plugin ctor includes all core lookups 68fdfce is described below commit 68fdfcec221ec9458ee0fd83d97d95977c4b54b7 Author: Carter Kozak AuthorDate: Fri Dec 24 12:19:43 2021 -0500 LOG4J2-3288 Interpolator non-plugin ctor includes all core lookups This adds missing lookups: `bundle`, `event`, and `sd` There's a comment suggesting that the PluginManager could be used, however that will require additional validation before I'm comfortable enabling it: Logging initialization is very static and tricky, and it's easy to produce deadlocks when referencing logging code within initialization. --- .../org/apache/logging/log4j/core/lookup/Interpolator.java | 3 +++ .../org/apache/logging/log4j/core/lookup/InterpolatorTest.java | 10 ++ src/changes/changes.xml| 3 +++ 3 files changed, 16 insertions(+) diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java index 077c0f8..e234692 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java @@ -109,6 +109,9 @@ public class Interpolator extends AbstractConfigurationAwareLookup { strLookupMap.put("java", new JavaLookup()); strLookupMap.put("lower", new LowerLookup()); strLookupMap.put("upper", new UpperLookup()); +strLookupMap.put("bundle", new ResourceBundleLookup()); +strLookupMap.put("event", new EventLookup()); +strLookupMap.put("sd", new StructuredDataLookup()); // JNDI if (JndiManager.isJndiLookupEnabled()) { try { diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/lookup/InterpolatorTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/lookup/InterpolatorTest.java index af0067b..3a4484c 100644 --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/lookup/InterpolatorTest.java +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/lookup/InterpolatorTest.java @@ -168,4 +168,14 @@ public class InterpolatorTest { .build(); assertEquals("mapMessage", interpolator.lookup(event, "map:key")); } + +@Test +public void testDefaultLookups() { +Interpolator noPluginInterpolator = new Interpolator(Collections.emptyMap()); +Interpolator pluginBasedInterpolator = new Interpolator(null, Collections.emptyList()); +assertEquals( +pluginBasedInterpolator.getStrLookupMap().keySet(), +noPluginInterpolator.getStrLookupMap().keySet(), +"Plugin and non-plugin Interpolator constructors should support the same features"); +} } diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 9c9c2a9..8f0e24a 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -31,6 +31,9 @@ --> + +Interpolator non-plugin constructor registers all lookups from log4j-core, previously it was missing event, sd, and bundle. + Correct SpringLookup package name in Interpolator.
[logging-log4j2] branch release-2.x updated: Add link to Release History in announcement.vm. (#642)
This is an automated email from the ASF dual-hosted git repository. vy pushed a commit to branch release-2.x in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git The following commit(s) were added to refs/heads/release-2.x by this push: new f5f15d7 Add link to Release History in announcement.vm. (#642) f5f15d7 is described below commit f5f15d71af0796e98102387257860a949b5bdfab Author: Volkan Yazici AuthorDate: Fri Dec 24 17:31:35 2021 +0100 Add link to Release History in announcement.vm. (#642) --- src/changes/announcement.vm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/changes/announcement.vm b/src/changes/announcement.vm index 352e27a..9dbeb17 100644 --- a/src/changes/announcement.vm +++ b/src/changes/announcement.vm @@ -133,3 +133,6 @@ reports, patches, or suggestions for improvement, see the Apache ${project.name} ${project.url} +--- + +Earlier release notes are accessible in [Release History](${project.url}changes-report.html).
[logging-log4j2] branch release-2.x updated: Make builds reproducible bit-for-bit.
This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch release-2.x in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git The following commit(s) were added to refs/heads/release-2.x by this push: new ed61f40 Make builds reproducible bit-for-bit. ed61f40 is described below commit ed61f407763eea562650f00cfec3c72caa576129 Author: Gary Gregory AuthorDate: Fri Dec 24 11:26:45 2021 -0500 Make builds reproducible bit-for-bit. See https://maven.apache.org/guides/mini/guide-reproducible-builds.html --- pom.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pom.xml b/pom.xml index 3ff60af..e28668c 100644 --- a/pom.xml +++ b/pom.xml @@ -245,6 +245,8 @@ 1.8 false UTF-8 + +10 Site Documentation 1.2
[logging-log4j2] branch master updated: define current build outputTimestamp (#654)
This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git The following commit(s) were added to refs/heads/master by this push: new 77746e7 define current build outputTimestamp (#654) 77746e7 is described below commit 77746e7e08eb52f3d1489f73a5936bb2d79f5ca9 Author: Hervé Boutemy AuthorDate: Fri Dec 24 17:21:24 2021 +0100 define current build outputTimestamp (#654) --- pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/pom.xml b/pom.xml index 75cd6e5..b0830ce 100644 --- a/pom.xml +++ b/pom.xml @@ -244,6 +244,7 @@ 11 false UTF-8 +10 Site Documentation 1.2
[logging-log4j2] branch master updated: LOG4J2-3204 Correct SpringLookup package name in Interpolator. (#617)
This is an automated email from the ASF dual-hosted git repository. vy pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git The following commit(s) were added to refs/heads/master by this push: new 65c367d LOG4J2-3204 Correct SpringLookup package name in Interpolator. (#617) 65c367d is described below commit 65c367dc3d45ac6b8185127b28bdc04c2f335a3c Author: Francis <956776...@qq.com> AuthorDate: Fri Dec 24 21:51:04 2021 +0800 LOG4J2-3204 Correct SpringLookup package name in Interpolator. (#617) --- .../logging/log4j/core/lookup/Interpolator.java | 2 +- .../logging/log4j/spring/boot/SpringLookupTest.java | 20 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java index c1edaee..0713017 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java @@ -148,7 +148,7 @@ public class Interpolator extends AbstractConfigurationAwareLookup { } try { strLookupMap.put(LOOKUP_KEY_SPRING, - Loader.newCheckedInstanceOf("org.apache.logging.log4j.spring.cloud.config.client.SpringLookup", StrLookup.class)); + Loader.newCheckedInstanceOf("org.apache.logging.log4j.spring.boot.SpringLookup", StrLookup.class)); } catch (final Exception ignored) { handleError(LOOKUP_KEY_SPRING, ignored); } diff --git a/log4j-spring-boot/src/test/java/org/apache/logging/log4j/spring/boot/SpringLookupTest.java b/log4j-spring-boot/src/test/java/org/apache/logging/log4j/spring/boot/SpringLookupTest.java index f934943..eb264f8 100644 --- a/log4j-spring-boot/src/test/java/org/apache/logging/log4j/spring/boot/SpringLookupTest.java +++ b/log4j-spring-boot/src/test/java/org/apache/logging/log4j/spring/boot/SpringLookupTest.java @@ -18,6 +18,8 @@ package org.apache.logging.log4j.spring.boot; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.core.LoggerContext; +import org.apache.logging.log4j.core.lookup.Interpolator; +import org.apache.logging.log4j.core.lookup.StrLookup; import org.junit.Test; import org.springframework.mock.env.MockEnvironment; @@ -57,4 +59,22 @@ public class SpringLookupTest { assertNotNull("Did not find property", result); assertEquals("Incorrect property value", "test", result); } + +@Test +public void testSpringLookupWithDefaultInterpolator() { +MockEnvironment env = new MockEnvironment(); +env.setActiveProfiles("test"); +env.setProperty("app.property", "test"); +LoggerContext context = (LoggerContext) LogManager.getContext(false); +context.putObject(Log4j2CloudConfigLoggingSystem.ENVIRONMENT_KEY, env); + +StrLookup lookup = new Interpolator(); +String result = lookup.lookup("spring:profiles.active"); +assertNotNull("No active profiles", result); +assertEquals("Incorrect active profile", "test", result); + +result = lookup.lookup("spring:app.property"); +assertNotNull("Did not find property", result); +assertEquals("Incorrect property value", "test", result); +} }
[logging-log4j2] branch release-2.x updated: LOG4J2-3204 Update changes.xml.
This is an automated email from the ASF dual-hosted git repository. vy pushed a commit to branch release-2.x in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git The following commit(s) were added to refs/heads/release-2.x by this push: new 55a1069 LOG4J2-3204 Update changes.xml. 55a1069 is described below commit 55a10692bd02cf51f0d172892bb61f2820925bdd Author: Volkan Yazici AuthorDate: Fri Dec 24 14:54:18 2021 +0100 LOG4J2-3204 Update changes.xml. --- src/changes/changes.xml | 5 + 1 file changed, 5 insertions(+) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index b984985..9c9c2a9 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -30,6 +30,10 @@ - "remove" - Removed --> + + +Correct SpringLookup package name in Interpolator. + log4j-to-slf4j takes the provided MessageFactory into account @@ -69,6 +73,7 @@ + Disable JNDI by default. Require log4j2.enableJndi to be set to true to allow JNDI.
[logging-log4j2] branch release-2.x updated: LOG4J2-3204 Correct SpringLookup package name in Interpolator. (#617)
This is an automated email from the ASF dual-hosted git repository. vy pushed a commit to branch release-2.x in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git The following commit(s) were added to refs/heads/release-2.x by this push: new 8a3363b LOG4J2-3204 Correct SpringLookup package name in Interpolator. (#617) 8a3363b is described below commit 8a3363b314a01df442778773fb595c0db9df180d Author: Francis <956776...@qq.com> AuthorDate: Fri Dec 24 21:51:04 2021 +0800 LOG4J2-3204 Correct SpringLookup package name in Interpolator. (#617) --- .../logging/log4j/core/lookup/Interpolator.java | 2 +- .../logging/log4j/spring/boot/SpringLookupTest.java | 20 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java index c22f66c..077c0f8 100644 --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/Interpolator.java @@ -148,7 +148,7 @@ public class Interpolator extends AbstractConfigurationAwareLookup { } try { strLookupMap.put(LOOKUP_KEY_SPRING, - Loader.newCheckedInstanceOf("org.apache.logging.log4j.spring.cloud.config.client.SpringLookup", StrLookup.class)); + Loader.newCheckedInstanceOf("org.apache.logging.log4j.spring.boot.SpringLookup", StrLookup.class)); } catch (final Exception ignored) { handleError(LOOKUP_KEY_SPRING, ignored); } diff --git a/log4j-spring-boot/src/test/java/org/apache/logging/log4j/spring/boot/SpringLookupTest.java b/log4j-spring-boot/src/test/java/org/apache/logging/log4j/spring/boot/SpringLookupTest.java index f934943..eb264f8 100644 --- a/log4j-spring-boot/src/test/java/org/apache/logging/log4j/spring/boot/SpringLookupTest.java +++ b/log4j-spring-boot/src/test/java/org/apache/logging/log4j/spring/boot/SpringLookupTest.java @@ -18,6 +18,8 @@ package org.apache.logging.log4j.spring.boot; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.core.LoggerContext; +import org.apache.logging.log4j.core.lookup.Interpolator; +import org.apache.logging.log4j.core.lookup.StrLookup; import org.junit.Test; import org.springframework.mock.env.MockEnvironment; @@ -57,4 +59,22 @@ public class SpringLookupTest { assertNotNull("Did not find property", result); assertEquals("Incorrect property value", "test", result); } + +@Test +public void testSpringLookupWithDefaultInterpolator() { +MockEnvironment env = new MockEnvironment(); +env.setActiveProfiles("test"); +env.setProperty("app.property", "test"); +LoggerContext context = (LoggerContext) LogManager.getContext(false); +context.putObject(Log4j2CloudConfigLoggingSystem.ENVIRONMENT_KEY, env); + +StrLookup lookup = new Interpolator(); +String result = lookup.lookup("spring:profiles.active"); +assertNotNull("No active profiles", result); +assertEquals("Incorrect active profile", "test", result); + +result = lookup.lookup("spring:app.property"); +assertNotNull("Did not find property", result); +assertEquals("Incorrect property value", "test", result); +} }
[logging-log4j2] 01/01: Simplify GitHub Actions workflow.
This is an automated email from the ASF dual-hosted git repository. vy pushed a commit to branch release-2.x in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git commit 8544b115db1a3d6cb1184430295fb90313abc0e8 Author: Volkan Yazici AuthorDate: Fri Dec 24 11:05:22 2021 +0100 Simplify GitHub Actions workflow. --- .github/workflows/benchmark.yml | 1 + .github/workflows/build.yml | 78 .github/workflows/main.yml | 98 - 3 files changed, 79 insertions(+), 98 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 7b55c9c..b441caf 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -31,6 +31,7 @@ jobs: uses: actions/checkout@v2 # JDK 11 is needed for the build. + # Search `maven-toolchains-plugin` usages for details. - name: Set up JDK 11 uses: actions/setup-java@v2.4.0 with: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000..08a2da0 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,78 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache license, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the license for the specific language governing permissions and +# limitations under the license. + +name: build + +on: [ push, pull_request ] + +jobs: + build: + +runs-on: ${{ matrix.os }} + +strategy: + matrix: +os: [ ubuntu-latest, windows-latest, macos-latest ] + +steps: + + - name: Checkout repository +uses: actions/checkout@v2 + + # JDK 11 is needed for the build. + # Search `maven-toolchains-plugin` usages for details. + - name: Setup JDK 11 +uses: actions/setup-java@v2.4.0 +with: + distribution: temurin + java-version: 11 + java-package: jdk + architecture: x64 + cache: maven + + # JDK 8 is needed for the build, and it is the primary bytecode target. + # Hence, JDK 8 is set up after 11, so that JAVA_HOME used by Maven during build will point to 8. + - name: Setup JDK 8 +uses: actions/setup-java@v2.3.0 +with: + distribution: temurin + java-version: 8 + java-package: jdk + architecture: x64 + cache: maven + + - name: Inspect environment (Linux) +if: runner.os == 'Linux' +run: env | grep '^JAVA' + + - name: Inspect environment (Windows) +if: runner.os == 'Windows' +run: set java + + - name: Inspect environment (MacOS) +if: runner.os == 'macOS' +run: env | grep '^JAVA' + + - name: Build with Maven +timeout-minutes: 60 +shell: bash +run: | + ./mvnw \ + --show-version --batch-mode --errors --no-transfer-progress \ + -DtrimStackTrace=false \ + -Dsurefire.rerunFailingTestsCount=2 \ + -Dlog4j2.junit.fileCleanerSleepPeriodMillis=1000 \ + --global-toolchains ".github/workflows/maven-toolchains.xml" \ + verify diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 7697112..000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,98 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache license, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the license for the specific language governing permissions and -# limitations under the license. - -name: CI - -on: [push, pull_request] - -jobs: - build: - -runs-on: ${{ matrix.os }} - -strategy: - matrix: -os: [ubuntu-latest, windows-latest, macos-latest] - -steps: - - - name: Checkout repository -uses: actio
[logging-log4j2] branch release-2.x updated (124ca65 -> 8544b11)
This is an automated email from the ASF dual-hosted git repository. vy pushed a change to branch release-2.x in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git. omit 124ca65 Simplify GitHub Actions workflow. new 8544b11 Simplify GitHub Actions workflow. This update added new revisions after undoing existing revisions. That is to say, some revisions that were in the old version of the branch are not in the new version. This situation occurs when a user --force pushes a change and generates a repository containing something like this: * -- * -- B -- O -- O -- O (124ca65) \ N -- N -- N refs/heads/release-2.x (8544b11) You should already have received notification emails for all of the O revisions, and so the following emails describe only the N revisions from the common base, B. Any revisions marked "omit" are not gone; other references still refer to them. Any revisions marked "discard" are gone forever. The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[logging-log4j2] branch release-2.x updated: Simplify GitHub Actions workflow.
This is an automated email from the ASF dual-hosted git repository. vy pushed a commit to branch release-2.x in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git The following commit(s) were added to refs/heads/release-2.x by this push: new 124ca65 Simplify GitHub Actions workflow. 124ca65 is described below commit 124ca6501953619f9b2e0b19a7eba3423ea0281b Author: Volkan Yazici AuthorDate: Fri Dec 24 11:05:22 2021 +0100 Simplify GitHub Actions workflow. --- .github/workflows/benchmark.yml | 1 + .github/workflows/build.yml | 78 .github/workflows/main.yml | 98 - 3 files changed, 79 insertions(+), 98 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 7b55c9c..b441caf 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -31,6 +31,7 @@ jobs: uses: actions/checkout@v2 # JDK 11 is needed for the build. + # Search `maven-toolchains-plugin` usages for details. - name: Set up JDK 11 uses: actions/setup-java@v2.4.0 with: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000..aee36c4 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,78 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache license, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the license for the specific language governing permissions and +# limitations under the license. + +name: build + +on: [ push, pull_request ] + +jobs: + build: + +runs-on: ${{ matrix.os }} + +strategy: + matrix: +os: [ ubuntu-latest, windows-latest, macos-latest ] + +steps: + + - name: Checkout repository +uses: actions/checkout@v2 + + # JDK 11 is needed for the build. + # Search `maven-toolchains-plugin` usages for details. + - name: Setup JDK 11 +uses: actions/setup-java@v2.4.0 +with: + distribution: temurin + java-version: 11 + java-package: jdk + architecture: x64 + cache: maven + + # JDK 8 is needed for the build, and it is the primary bytecode target. + # Hence, JDK 8 is set up after 11, so that JAVA_HOME used by Maven during build will point to 8. + - name: Setup JDK 8 +uses: actions/setup-java@v2.3.0 +with: + distribution: temurin + java-version: 8 + java-package: jdk + architecture: x64 + cache: maven + + - name: Inspect environment (Linux) +if: runner.os == 'Linux' +run: env | grep '^JAVA' + + - name: Inspect environment (Windows) +if: runner.os == 'Windows' +run: set java + + - name: Inspect environment (MacOS) +if: runner.os == 'macOS' +run: env | grep '^JAVA' + + - name: Build with Maven +timeout-minutes: 60 +shell: bash +run: | + ./mvnw \ + --show-version --batch-mode --errors --no-transfer-progress \ + -DtrimStackTrace=false \ + -Dsurefire.rerunFailingTestsCount=2 \ + -Dlog4j2.junit.fileCleanerSleepPeriodMillis=1000 \ + --global-toolchains ".github\workflows\maven-toolchains.xml" \ + verify diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 7697112..000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,98 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache license, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the license for the specific language governing permissions and -# limitations under the license. - -name: CI - -on: [push, pull_request] - -jobs: - build: - -runs-on: ${{ matrix.os }} - -