Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed @PluginAttribute 'patternFlags' argument from @PluginFactory for RegexFilter. (#3086) #3463

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f0ec0b8
Removed 'patternFlags' @PluginAttribute from RegexFilter @PluginFacto…
jethomas-tsi Feb 12, 2025
8c0e3c6
Improve configuration error handling of HttpAppender (#3438)
Suvrat1629 Feb 16, 2025
dd7b6d3
Updates per PR Code Review (#3086)
jethomas-tsi Feb 17, 2025
29e472b
A few more improvements + added tests (#3086)
jethomas-tsi Feb 17, 2025
85c6c9b
Publish build scans to develocity.apache.org (#3396)
clayburn Feb 18, 2025
fef8af8
Fix null termination advice for SOA and JTL
vy Feb 18, 2025
55b799b
Bump org.apache.logging:logging-parent from 11.3.0 to 12.0.0 in /log4…
dependabot[bot] Feb 18, 2025
382ea9b
Run reproducibility check after each deployment
ppkarwasz Oct 17, 2024
3846632
Run integration tests after each deployment (#3105)
ppkarwasz Feb 18, 2025
2b9a15f
Fix revision to `2.25.0-SNAPSHOT`
ppkarwasz Feb 18, 2025
f203d86
Fix Nexus URL for snapshots
ppkarwasz Feb 18, 2025
bd4607c
Update `org.apache.cassandra:cassandra-all` to version `3.11.19` (#3440)
asf-rm Feb 18, 2025
92d6efb
Activate `bom` profile in `log4j-bom`
ppkarwasz Feb 19, 2025
2202b58
Add Nexus URL argument to `generate-email.sh` per `logging-parent` up…
vy Feb 19, 2025
c3fa946
Document `maven-compiler-plugin` override
vy Feb 19, 2025
ae77c09
Update `org.mongodb:bson` to version `5.3.1` (#3409)
asf-rm Feb 19, 2025
0891d6b
Fix formatting of `s` pattern (#3469)
ppkarwasz Feb 19, 2025
eefffd9
Update `co.elastic.clients:elasticsearch-java` to version `8.17.2` (#…
asf-rm Feb 19, 2025
71a03d7
Update `commons-codec:commons-codec` to version `1.18.0` (#3421)
asf-rm Feb 19, 2025
f98bff4
Bump commons-logging:commons-logging in /log4j-parent (#3445)
dependabot[bot] Feb 19, 2025
5aac7d6
Update `org.openrewrite.recipe:rewrite-logging-frameworks` to version…
asf-rm Feb 19, 2025
07590bc
Add `collectionName` and `databaseName` attributes to `MongoDbProvide…
vy Feb 20, 2025
14adc25
Add changelog entry (#3066)
vy Feb 21, 2025
9bc402e
Update `fast-xml-parser` to version `5.0.6` (#3487)
asf-rm Feb 24, 2025
bf6ef23
Update `org.junit:junit-bom` to version `5.12.0` (#3488)
asf-rm Feb 24, 2025
6f4fab9
Update `org.awaitility:awaitility` to version `4.3.0` (#3489)
asf-rm Feb 24, 2025
dde535f
Update `org.slf4j:slf4j-nop` to version `2.0.17` (#3496)
asf-rm Feb 26, 2025
56d14a4
Update `org.slf4j:slf4j-nop` to version `2.0.17` (#3490)
asf-rm Feb 26, 2025
ca14c95
Update `org.slf4j:slf4j-api` to version `2.0.17` (#3492)
asf-rm Feb 26, 2025
2d08264
Update `org.slf4j:slf4j-api` to version `2.0.17` (#3497)
asf-rm Feb 26, 2025
b7cccc1
Update `org.slf4j:slf4j-api` to version `2.0.17` (#3498)
asf-rm Feb 26, 2025
727c992
Update `org.slf4j:slf4j-api` to version `2.0.17` (#3499)
asf-rm Feb 26, 2025
d8cbe77
Bugfix/log4 j 3359 2 (#3502)
JWT007 Feb 27, 2025
1da1d7e
Update `org.apache.groovy:groovy-bom` to version `4.0.26` (#3506)
asf-rm Feb 28, 2025
8d05a73
Fixed AbstractFilterable#isFiltered javadoc (#3300) (#3456)
JWT007 Mar 1, 2025
ffbdda5
Removed 'patternFlags' @PluginAttribute from RegexFilter @PluginFacto…
jethomas-tsi Feb 12, 2025
d5d7aed
Updates per PR Code Review (#3086)
jethomas-tsi Feb 17, 2025
6e7e82d
A few more improvements + added tests (#3086)
jethomas-tsi Feb 17, 2025
0ac7478
Merge remote-tracking branch 'jwt007/bugfix/LOG4J-3086' into bugfix/L…
JWT007 Mar 2, 2025
283dcff
Fix validation behavior in RegexFilter (#3086)
JWT007 Mar 2, 2025
6f1358c
Fixed a reverse logic check in a validation (#3086)
JWT007 Mar 2, 2025
c7f89d8
Fix Spotless errors (#3086)
JWT007 Mar 2, 2025
d6b5574
Fix RegexFilterTest (#3086)
JWT007 Mar 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/generate-email.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ stderr() {

fail_for_invalid_args() {
stderr "Invalid arguments!"
stderr "Expected arguments: <vote|announce> <version> <commitId>"
stderr "Expected arguments: <vote|announce> <version> <commitId> <nexusUrl>"
exit 1
}

# Check arguments
[ $# -ne 3 ] && fail_for_invalid_args
[ $# -ne 4 ] && fail_for_invalid_args

# Constants
PROJECT_NAME="Apache Log4j"
Expand All @@ -43,6 +43,7 @@ PROJECT_SITE="https://logging.apache.org/$PROJECT_ID"
PROJECT_STAGING_SITE="${PROJECT_SITE/apache.org/staged.apache.org}"
PROJECT_REPO="https://github.com/apache/logging-log4j2"
COMMIT_ID="$3"
NEXUS_URL="$4"
PROJECT_DIST_URL="https://dist.apache.org/repos/dist/dev/logging/$PROJECT_ID/$PROJECT_VERSION"

# Check release notes file
Expand Down Expand Up @@ -71,7 +72,7 @@ Website: $PROJECT_STAGING_SITE/$PROJECT_VERSION/index.html
GitHub: $PROJECT_REPO
Commit: $COMMIT_ID
Distribution: $PROJECT_DIST_URL
Nexus: https://repository.apache.org/content/repositories/orgapachelogging-<FIXME>
Nexus: $NEXUS_URL
Signing key: 0x077e8893a6dcc33dd4a4d5b256e73ba9a0b592d0
Review kit: https://logging.apache.org/logging-parent/release-review-instructions.html

Expand Down
32 changes: 27 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ jobs:

build:
if: github.actor != 'dependabot[bot]'
uses: apache/logging-parent/.github/workflows/build-reusable.yaml@rel/11.3.0
uses: apache/logging-parent/.github/workflows/build-reusable.yaml@rel/12.0.0
secrets:
DV_ACCESS_TOKEN: ${{ startsWith(github.ref_name, 'release/') && '' || secrets.GE_ACCESS_TOKEN }}
DV_ACCESS_TOKEN: ${{ startsWith(github.ref_name, 'release/') && '' || secrets.DEVELOCITY_ACCESS_KEY }}
with:
java-version: |
8
17
site-enabled: true
reproducibility-check-enabled: ${{ startsWith(github.ref_name, 'release/') }}
reproducibility-check-enabled: false
develocity-enabled: ${{ ! startsWith(github.ref_name, 'release/') }}

deploy-snapshot:
needs: build
if: github.repository == 'apache/logging-log4j2' && github.ref_name == '2.x'
uses: apache/logging-parent/.github/workflows/deploy-snapshot-reusable.yaml@rel/11.3.0
uses: apache/logging-parent/.github/workflows/deploy-snapshot-reusable.yaml@rel/12.0.0
# Secrets for deployments
secrets:
NEXUS_USERNAME: ${{ secrets.NEXUS_USER }}
Expand All @@ -57,7 +57,7 @@ jobs:
deploy-release:
needs: build
if: github.repository == 'apache/logging-log4j2' && startsWith(github.ref_name, 'release/')
uses: apache/logging-parent/.github/workflows/deploy-release-reusable.yaml@rel/11.3.0
uses: apache/logging-parent/.github/workflows/deploy-release-reusable.yaml@rel/12.0.0
# Secrets for deployments
secrets:
GPG_SECRET_KEY: ${{ secrets.LOGGING_GPG_SECRET_KEY }}
Expand All @@ -73,3 +73,25 @@ jobs:
8
17
project-id: log4j

verify-reproducibility:
needs: [ deploy-snapshot, deploy-release ]
if: ${{ always() && (needs.deploy-snapshot.result == 'success' || needs.deploy-release.result == 'success') }}
name: "verify-reproducibility (${{ needs.deploy-release.result == 'success' && needs.deploy-release.outputs.project-version || needs.deploy-snapshot.outputs.project-version }})"
uses: apache/logging-parent/.github/workflows/verify-reproducibility-reusable.yaml@rel/12.0.0
with:
nexus-url: ${{ needs.deploy-release.result == 'success' && needs.deploy-release.outputs.nexus-url || 'https://repository.apache.org/content/groups/snapshots' }}
# Encode the `runs-on` input as JSON array
runs-on: '["ubuntu-latest", "macos-latest", "windows-latest"]'

# Run integration-tests automatically after a snapshot or RC is published
integration-test:
needs: [ deploy-snapshot, deploy-release ]
if: ${{ always() && (needs.deploy-snapshot.result == 'success' || needs.deploy-release.result == 'success') }}
name: "integration-test (${{ needs.deploy-release.result == 'success' && needs.deploy-release.outputs.project-version || needs.deploy-snapshot.outputs.project-version }})"
uses: apache/logging-log4j-samples/.github/workflows/integration-test.yaml@main
with:
log4j-version: ${{ needs.deploy-release.result == 'success' && needs.deploy-release.outputs.project-version || needs.deploy-snapshot.outputs.project-version }}
log4j-repository-url: ${{ needs.deploy-release.result == 'success' && needs.deploy-release.outputs.nexus-url || needs.deploy-snapshot.outputs.nexus-url }}
# Use the `main` branch of `logging-log4j-samples`
samples-ref: 'refs/heads/main'
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ permissions: read-all
jobs:

analyze:
uses: apache/logging-parent/.github/workflows/codeql-analysis-reusable.yaml@rel/11.3.0
uses: apache/logging-parent/.github/workflows/codeql-analysis-reusable.yaml@rel/12.0.0
with:
java-version: |
8
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/deploy-site.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

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

deploy-site-pro:
if: github.repository == 'apache/logging-log4j2' && github.ref_name == '2.x-site-pro'
uses: apache/logging-parent/.github/workflows/deploy-site-reusable.yaml@rel/11.3.0
uses: apache/logging-parent/.github/workflows/deploy-site-reusable.yaml@rel/12.0.0
# Secrets for committing the generated site
secrets:
GPG_SECRET_KEY: ${{ secrets.LOGGING_GPG_SECRET_KEY }}
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:

deploy-site-rel:
needs: export-version
uses: apache/logging-parent/.github/workflows/deploy-site-reusable.yaml@rel/11.3.0
uses: apache/logging-parent/.github/workflows/deploy-site-reusable.yaml@rel/12.0.0
# Secrets for committing the generated site
secrets:
GPG_SECRET_KEY: ${{ secrets.LOGGING_GPG_SECRET_KEY }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/develocity-publish-build-scans.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ jobs:
- name: Publish Build Scans
uses: gradle/develocity-actions/maven-publish-build-scan@b8d3a572314ffff3b940a2c1b7b384d4983d422d # 1.3
with:
develocity-url: 'https://ge.apache.org'
develocity-access-key: ${{ secrets.GE_ACCESS_TOKEN }}
develocity-url: 'https://develocity.apache.org'
develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }}
6 changes: 3 additions & 3 deletions .github/workflows/merge-dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ jobs:

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

merge-dependabot:
needs: build
uses: apache/logging-parent/.github/workflows/merge-dependabot-reusable.yaml@rel/11.3.0
uses: apache/logging-parent/.github/workflows/merge-dependabot-reusable.yaml@rel/12.0.0
with:
java-version: 17
permissions:
Expand Down
16 changes: 16 additions & 0 deletions .logging-parent-bom-activator
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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.
##
This file activates the `flatten-bom` profile.
2 changes: 1 addition & 1 deletion .mvn/develocity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<develocity>
<projectId>logging-log4j2</projectId>
<server>
<url>https://ge.apache.org</url>
<url>https://develocity.apache.org</url>
</server>
<buildScan>
<capture>
Expand Down
2 changes: 1 addition & 1 deletion log4j-core-its/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<spotbugs.skip>true</spotbugs.skip>

<!-- Dependency versions -->
<slf4j2.version>2.0.16</slf4j2.version>
<slf4j2.version>2.0.17</slf4j2.version>

</properties>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/*
* 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.
*/
package org.apache.logging.log4j.core.appender;

import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.net.MalformedURLException;
import java.net.URL;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.core.Layout;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.DefaultConfiguration;
import org.apache.logging.log4j.core.config.Property;
import org.apache.logging.log4j.core.layout.JsonLayout;
import org.apache.logging.log4j.core.net.ssl.SslConfiguration;
import org.apache.logging.log4j.test.ListStatusListener;
import org.apache.logging.log4j.test.junit.UsingStatusListener;
import org.junit.jupiter.api.Test;

class HttpAppenderBuilderTest {

private HttpAppender.Builder<?> getBuilder() {
Configuration mockConfig = new DefaultConfiguration();
return HttpAppender.newBuilder().setConfiguration(mockConfig).setName("TestHttpAppender"); // Name is required
}

@Test
@UsingStatusListener
void testBuilderWithoutUrl(final ListStatusListener listener) throws Exception {
HttpAppender appender = HttpAppender.newBuilder()
.setConfiguration(new DefaultConfiguration())
.setName("TestAppender")
.setLayout(JsonLayout.createDefaultLayout()) // Providing a layout here
.build();

assertThat(listener.findStatusData(Level.ERROR))
.anyMatch(statusData ->
statusData.getMessage().getFormattedMessage().contains("HttpAppender requires URL to be set."));
}

@Test
@UsingStatusListener
void testBuilderWithUrlAndWithoutLayout(final ListStatusListener listener) throws Exception {
HttpAppender appender = HttpAppender.newBuilder()
.setConfiguration(new DefaultConfiguration())
.setName("TestAppender")
.setUrl(new URL("http://localhost:8080/logs"))
.build();

assertThat(listener.findStatusData(Level.ERROR)).anyMatch(statusData -> statusData
.getMessage()
.getFormattedMessage()
.contains("HttpAppender requires a layout to be set."));
}

@Test
void testBuilderWithValidConfiguration() throws Exception {
URL url = new URL("http://example.com");
Layout<?> layout = JsonLayout.createDefaultLayout();

HttpAppender.Builder<?> builder = getBuilder().setUrl(url).setLayout(layout);

HttpAppender appender = builder.build();
assertNotNull(appender, "HttpAppender should be created with valid configuration.");
}

@Test
void testBuilderWithCustomMethod() throws Exception {
URL url = new URL("http://example.com");
Layout<?> layout = JsonLayout.createDefaultLayout();
String customMethod = "PUT";

HttpAppender.Builder<?> builder =
getBuilder().setUrl(url).setLayout(layout).setMethod(customMethod);

HttpAppender appender = builder.build();
assertNotNull(appender, "HttpAppender should be created with a custom HTTP method.");
}

@Test
void testBuilderWithHeaders() throws Exception {
URL url = new URL("http://example.com");
Layout<?> layout = JsonLayout.createDefaultLayout();
Property[] headers = new Property[] {
Property.createProperty("Header1", "Value1"), Property.createProperty("Header2", "Value2")
};

HttpAppender.Builder<?> builder =
getBuilder().setUrl(url).setLayout(layout).setHeaders(headers);

HttpAppender appender = builder.build();
assertNotNull(appender, "HttpAppender should be created with headers.");
}

@Test
void testBuilderWithSslConfiguration() throws Exception {
URL url = new URL("https://example.com");
Layout<?> layout = JsonLayout.createDefaultLayout();

// Use real SslConfiguration instead of Mockito mock
SslConfiguration sslConfig = SslConfiguration.createSSLConfiguration(null, null, null, false);

HttpAppender.Builder<?> builder =
getBuilder().setUrl(url).setLayout(layout).setSslConfiguration(sslConfig);

HttpAppender appender = builder.build();
assertNotNull(appender, "HttpAppender should be created with SSL configuration.");
}

@Test
void testBuilderWithInvalidUrl() {
assertThrows(MalformedURLException.class, () -> new URL("invalid-url"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class AbstractFilterTest {
@Test
void testUnrolledBackwardsCompatible() {
final ConcreteFilter filter = new ConcreteFilter();
final Filter.Result expected = Filter.Result.DENY;
verifyMethodsWithUnrolledVarargs(filter, Filter.Result.DENY);

filter.testResult = Filter.Result.ACCEPT;
Expand Down
Loading