Skip to content

Commit 26d4fbd

Browse files
committed
Merge remote-tracking branch 'apache/2.x' into feature/2.x/separate-reproducibility-check
2 parents 90dc464 + 55b799b commit 26d4fbd

File tree

953 files changed

+13688
-8255
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

953 files changed

+13688
-8255
lines changed

.github/dependabot.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ updates:
4545

4646
- package-ecosystem: maven
4747
directories:
48-
- "/"
4948
- "/log4j-1.2-api"
5049
- "/log4j-api-test"
5150
- "/log4j-api"
@@ -59,6 +58,7 @@ updates:
5958
- "/log4j-docker"
6059
- "/log4j-fuzz-test"
6160
- "/log4j-iostreams"
61+
- "/log4j-jakarta-jms"
6262
- "/log4j-jakarta-smtp"
6363
- "/log4j-jakarta-web"
6464
- "/log4j-jcl"
@@ -163,7 +163,6 @@ updates:
163163
- package-ecosystem: maven
164164
directories:
165165
- "/log4j-mongodb4"
166-
- "/log4j-slf4j-impl"
167166
open-pull-requests-limit: 10
168167
schedule:
169168
interval: "daily"
@@ -174,9 +173,6 @@ updates:
174173
# MongoDB 4.x should only upgrade to 4.x
175174
- dependency-name: "org.mongodb:*"
176175
versions: [ "[5,)" ]
177-
# SLF4J 1.7.x should only upgrade to 1.7.x and
178-
- dependency-name: "org.slf4j:slf4j-api"
179-
versions: [ "[1,)" ]
180176

181177
- package-ecosystem: github-actions
182178
directory: "/"

.github/workflows/build.yaml

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ jobs:
3030

3131
build:
3232
if: github.actor != 'dependabot[bot]'
33-
uses: apache/logging-parent/.github/workflows/build-reusable.yaml@feature/reproducibility-check
33+
uses: apache/logging-parent/.github/workflows/build-reusable.yaml@rel/12.0.0
3434
secrets:
35-
DV_ACCESS_TOKEN: ${{ startsWith(github.ref_name, 'release/') && '' || secrets.GE_ACCESS_TOKEN }}
35+
DV_ACCESS_TOKEN: ${{ startsWith(github.ref_name, 'release/') && '' || secrets.DEVELOCITY_ACCESS_KEY }}
3636
with:
3737
java-version: |
3838
8
@@ -43,10 +43,8 @@ jobs:
4343

4444
deploy-snapshot:
4545
needs: build
46-
# FIXME: Restore `2.x` before merging
47-
# if: github.repository == 'apache/logging-log4j2' && github.ref_name == '2.x'
48-
if: github.repository == 'apache/logging-log4j2' && github.ref == 'refs/pull/3105/merge'
49-
uses: apache/logging-parent/.github/workflows/deploy-snapshot-reusable.yaml@feature/reproducibility-check
46+
if: github.repository == 'apache/logging-log4j2' && github.ref_name == '2.x'
47+
uses: apache/logging-parent/.github/workflows/deploy-snapshot-reusable.yaml@rel/12.0.0
5048
# Secrets for deployments
5149
secrets:
5250
NEXUS_USERNAME: ${{ secrets.NEXUS_USER }}
@@ -59,7 +57,7 @@ jobs:
5957
deploy-release:
6058
needs: build
6159
if: github.repository == 'apache/logging-log4j2' && startsWith(github.ref_name, 'release/')
62-
uses: apache/logging-parent/.github/workflows/deploy-release-reusable.yaml@feature/reproducibility-check
60+
uses: apache/logging-parent/.github/workflows/deploy-release-reusable.yaml@rel/12.0.0
6361
# Secrets for deployments
6462
secrets:
6563
GPG_SECRET_KEY: ${{ secrets.LOGGING_GPG_SECRET_KEY }}
@@ -80,7 +78,7 @@ jobs:
8078
needs: [ deploy-snapshot, deploy-release ]
8179
if: ${{ always() && (needs.deploy-snapshot.result == 'success' || needs.deploy-release.result == 'success') }}
8280
name: "verify-reproducibility (${{ needs.deploy-release.result == 'success' && needs.deploy-release.outputs.project-version || needs.deploy-snapshot.outputs.project-version }})"
83-
uses: apache/logging-parent/.github/workflows/verify-reproducibility-reusable.yaml@feature/reproducibility-check
81+
uses: apache/logging-parent/.github/workflows/verify-reproducibility-reusable.yaml@12.0.0
8482
with:
8583
nexus-url: ${{ needs.deploy-release.result == 'success' && needs.deploy-release.outputs.nexus-url || needs.deploy-snapshot.outputs.nexus-url }}
8684
# Encode the `runs-on` input as JSON array

.github/workflows/codeql-analysis.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ permissions: read-all
3030
jobs:
3131

3232
analyze:
33-
uses: apache/logging-parent/.github/workflows/codeql-analysis-reusable.yaml@rel/11.3.0
33+
uses: apache/logging-parent/.github/workflows/codeql-analysis-reusable.yaml@rel/12.0.0
3434
with:
3535
java-version: |
3636
8

.github/workflows/deploy-site.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333

3434
deploy-site-stg:
3535
if: github.repository == 'apache/logging-log4j2' && github.ref_name == '2.x'
36-
uses: apache/logging-parent/.github/workflows/deploy-site-reusable.yaml@rel/11.3.0
36+
uses: apache/logging-parent/.github/workflows/deploy-site-reusable.yaml@rel/12.0.0
3737
# Secrets for committing the generated site
3838
secrets:
3939
GPG_SECRET_KEY: ${{ secrets.LOGGING_GPG_SECRET_KEY }}
@@ -51,7 +51,7 @@ jobs:
5151

5252
deploy-site-pro:
5353
if: github.repository == 'apache/logging-log4j2' && github.ref_name == '2.x-site-pro'
54-
uses: apache/logging-parent/.github/workflows/deploy-site-reusable.yaml@rel/11.3.0
54+
uses: apache/logging-parent/.github/workflows/deploy-site-reusable.yaml@rel/12.0.0
5555
# Secrets for committing the generated site
5656
secrets:
5757
GPG_SECRET_KEY: ${{ secrets.LOGGING_GPG_SECRET_KEY }}
@@ -81,7 +81,7 @@ jobs:
8181
8282
deploy-site-rel:
8383
needs: export-version
84-
uses: apache/logging-parent/.github/workflows/deploy-site-reusable.yaml@rel/11.3.0
84+
uses: apache/logging-parent/.github/workflows/deploy-site-reusable.yaml@rel/12.0.0
8585
# Secrets for committing the generated site
8686
secrets:
8787
GPG_SECRET_KEY: ${{ secrets.LOGGING_GPG_SECRET_KEY }}

.github/workflows/develocity-publish-build-scans.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ jobs:
3131
steps:
3232

3333
- name: Setup Build Scan link capture
34-
uses: gradle/develocity-actions/maven-setup@9f1bf05334de7eb619731d5466c35a153742311d # 1.2
34+
uses: gradle/develocity-actions/setup-maven@b8d3a572314ffff3b940a2c1b7b384d4983d422d # 1.3
35+
with:
36+
capture-build-scan-links: true
3537

3638
- name: Publish Build Scans
37-
uses: gradle/develocity-actions/maven-publish-build-scan@9f1bf05334de7eb619731d5466c35a153742311d # 1.2
39+
uses: gradle/develocity-actions/maven-publish-build-scan@b8d3a572314ffff3b940a2c1b7b384d4983d422d # 1.3
3840
with:
39-
develocity-url: 'https://ge.apache.org'
40-
develocity-access-key: ${{ secrets.GE_ACCESS_TOKEN }}
41+
develocity-url: 'https://develocity.apache.org'
42+
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}

.github/workflows/merge-dependabot.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ jobs:
3030

3131
build:
3232
if: github.repository == 'apache/logging-log4j2' && github.event_name == 'pull_request_target' && github.actor == 'dependabot[bot]'
33-
uses: apache/logging-parent/.github/workflows/build-reusable.yaml@rel/11.3.0
33+
uses: apache/logging-parent/.github/workflows/build-reusable.yaml@rel/12.0.0
3434
secrets:
35-
DV_ACCESS_TOKEN: ${{ secrets.GE_ACCESS_TOKEN }}
35+
DV_ACCESS_TOKEN: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
3636
with:
3737
java-version: |
3838
8
@@ -42,7 +42,7 @@ jobs:
4242

4343
merge-dependabot:
4444
needs: build
45-
uses: apache/logging-parent/.github/workflows/merge-dependabot-reusable.yaml@rel/11.3.0
45+
uses: apache/logging-parent/.github/workflows/merge-dependabot-reusable.yaml@rel/12.0.0
4646
with:
4747
java-version: 17
4848
permissions:

.mvn/develocity.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<develocity>
33
<projectId>logging-log4j2</projectId>
44
<server>
5-
<url>https://ge.apache.org</url>
5+
<url>https://develocity.apache.org</url>
66
</server>
77
<buildScan>
88
<capture>

BUILDING.adoc

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,3 +172,59 @@ CI=true ./mvnw ...
172172
=== Compilation in IntelliJ IDEA fails with `java: plug-in not found: ErrorProne`
173173
174174
Try removing all _"Override compiler parameters per-module"_ entries in _"Settings > Build, Execution, Deployment > Compiler > Java Compiler"_.
175+
176+
[#development-api-compatibility]
177+
=== Fixing API compatibility check failures
178+
179+
Log4j uses the
180+
https://github.com/bndtools/bnd/tree/master/maven-plugins/bnd-baseline-maven-plugin[BND Baseline Maven Plugin]
181+
to enforce its
182+
https://semver.org/[semantic versioning policy].
183+
Following the
184+
https://bnd.bndtools.org/chapters/170-versioning.html#best-practices[OSGi versioning best practices], both Log4j artifacts and packages are versioned.
185+
If you modify Log4j's public API, a BND Baseline error like the following will occur:
186+
187+
[source]
188+
----
189+
Name Type Delta New Old Suggest If Prov.
190+
org.apache.logging.foo PACKAGE UNCHANGED 2.1.0 2.1.0 ok -
191+
* org.apache.logging.foo.bar PACKAGE MINOR 2.3.4 2.3.4 2.4.0 -
192+
MINOR PACKAGE org.apache.logging.foo.bar
193+
...
194+
----
195+
196+
The solution of the error depends on the change kind (`Delta`):
197+
198+
[#development-api-compatibility-micro]
199+
`MICRO`::
200+
+
201+
For patch level changes modify the `package-info.java` file of the `org.apache.logging.foo.bar` package and update the `@Version` annotation to the number suggested by BND: increment just the patch number.
202+
+
203+
[source,java]
204+
----
205+
@Version("2.3.5")
206+
package org.apache.logging.foo.bar;
207+
----
208+
209+
[#development-api-compatibility-minor]
210+
`MINOR`::
211+
+
212+
Changes of type `MINOR` require more work:
213+
+
214+
--
215+
* Make sure that the current Log4j version is a minor upgrade over the last released version.
216+
If that is not the case (e.g., it is `2.34.5-SNAPSHOT`) modify the `<revision>` property in the main POM file (e.g., change it to `2.35.0-SNAPSHOT`).
217+
* Make sure to add a
218+
https://logging.apache.org/log4j/tools/log4j-changelog.html#changelog-entry-file[changelog entry]
219+
of type `added`, `changed` or `deprecated` to your PR.
220+
* As in the
221+
<<development-api-compatibility-micro,`MICRO` case>>
222+
modify the `package-info.java` file of the package and update the `@Version` annotation to the **next Log4j version** (`2.35.0` in the example) and **not** the minimal version number suggested by BND.
223+
The purpose of this policy is to have an alignment between package versions and the last Log4j version, where an API change occurred.
224+
--
225+
226+
[#development-api-compatibility-major]
227+
`MAJOR`::
228+
+
229+
Changes of type `MAJOR` (i.e. breaking changes) are not accepted in the `2.x` branch.
230+
If you believe it is not a breaking change (e.g., you removed a class **documented** as private), the development team will guide you on how to solve it.

log4j-1.2-api/pom.xml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,12 @@
4343
com.sun.jdmk.comm;resolution:=optional,
4444
<!-- JMS is optional -->
4545
javax.jms;version="[1.1,3)";resolution:=optional,
46-
<!-- Log4j Core is optional -->
47-
org.apache.logging.log4j.core.*;resolution:=optional
4846
</bnd-extra-package-options>
47+
<bnd-extra-module-options>
48+
<!-- Log4j Core is optional -->
49+
org.apache.logging.log4j.core;static=true
50+
</bnd-extra-module-options>
4951
<Fragment-Host>org.apache.logging.log4j.core</Fragment-Host>
50-
<!-- we have an `bnd.bnd` file to override the parent's defaults -->
5152
</properties>
5253

5354
<dependencies>
@@ -112,6 +113,7 @@
112113
<scope>test</scope>
113114
</dependency>
114115

116+
<!-- JUnit -->
115117
<dependency>
116118
<groupId>org.junit.jupiter</groupId>
117119
<artifactId>junit-jupiter-engine</artifactId>
@@ -123,10 +125,9 @@
123125
<artifactId>junit-jupiter-params</artifactId>
124126
<scope>test</scope>
125127
</dependency>
126-
127128
<dependency>
128-
<groupId>org.junit.vintage</groupId>
129-
<artifactId>junit-vintage-engine</artifactId>
129+
<groupId>org.hamcrest</groupId>
130+
<artifactId>hamcrest</artifactId>
130131
<scope>test</scope>
131132
</dependency>
132133

log4j-1.2-api/src/main/java/org/apache/log4j/Level.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,7 @@ protected Level(
115115
final String levelStr,
116116
final int syslogEquivalent,
117117
final org.apache.logging.log4j.Level version2Equivalent) {
118-
super(level, levelStr, syslogEquivalent);
119-
this.version2Level = version2Equivalent != null ? version2Equivalent : OptionConverter.createLevel(this);
118+
super(level, levelStr, syslogEquivalent, version2Equivalent);
120119
}
121120

122121
/**
@@ -222,6 +221,7 @@ private void readObject(final ObjectInputStream s) throws IOException, ClassNotF
222221
if (levelStr == null) {
223222
levelStr = Strings.EMPTY;
224223
}
224+
version2Level = OptionConverter.createLevel(this);
225225
}
226226

227227
/**

0 commit comments

Comments
 (0)