Re: [PR] MDC and NDC availablity no longer depend on APR thread support [logging-log4cxx]
swebb2066 commented on PR #299: URL: https://github.com/apache/logging-log4cxx/pull/299#issuecomment-1821980162 > should these #if be reversed, such that if it has thread_local that takes precedence over APR? I have not yet sure that using thread_local instead of APR would make some some subtle behaviour change. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Commented] (LOG4J2-1477) @NonNull support (for @NonNullByDefault or similar)
[ https://issues.apache.org/jira/browse/LOG4J2-1477?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17788573#comment-17788573 ] Matt Sicker commented on LOG4J2-1477: - I like this JSpecify draft, though it's a draft, and I doubt they'll be at 1.0 by the time we're cutting 3.0.0. Perhaps I can align our annotations with these, and when this spec is finished, we can do some sort of search and replace for them via OpenRewrite. > @NonNull support (for @NonNullByDefault or similar) > --- > > Key: LOG4J2-1477 > URL: https://issues.apache.org/jira/browse/LOG4J2-1477 > Project: Log4j 2 > Issue Type: Wish > Components: API >Affects Versions: 2.6.2 > Environment: any >Reporter: Bojan Antonović >Assignee: Matt Sicker >Priority: Major > Fix For: 3.0.0 > > > Eclipse (and other tools) offer non-null checks by annotation processing. > One of the possibilities to enable this is to add the annotation > @org.eclipse.jdt.annotation.NonNullByDefault in your package-info.java file. > Example: > @org.eclipse.jdt.annotation.NonNullByDefault > package foo; > A frequent problem is reported when using a logger: > private static final Logger LOGGER = LogManager.getLogger(Bla.class); > for which Eclipse says: > Null type safety (type annotations): The expression of type 'Logger' needs > unchecked conversion to conform to '@NonNull Logger' Bla.java (...) > This can by bypassed by putting a @SuppressWarnings("null") over the > expression, but this has to be done in every class, and may be the *only* > line of code with this workaround. > Problems: > - There are other annotations for non-null (javax.annotation.Nonnull) and > many other frameworks, like the Checker Framework. > - I don't want to be a judge which one to choose. > - Deeper support may require a dependency on Java 8. > - If you want to do it framework wide, this can be a huge task. > - As some tools are not mature (IMHO), it will need experiments. -- This message was sent by Atlassian Jira (v8.20.10#820010)
[jira] [Commented] (LOG4J2-1477) @NonNull support (for @NonNullByDefault or similar)
[ https://issues.apache.org/jira/browse/LOG4J2-1477?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17788572#comment-17788572 ] Matt Sicker commented on LOG4J2-1477: - So far, they're just aliases for {{javax.annotation.Nonnull}} just like most other implementations, so they all work together just fine. Really, what I'd like here are a set of nullability annotations that work similarly but are not retained at runtime (which is what the JSR305 version is doing, hence the need for annotation aliases) so we don't need the annotation jar as a runtime dependency. I'm in favor of whatever solution allows us to keep log4j-api as a {{{}java.base{}}}-only module (which itself has required a bit of refactoring to push out optional dependencies into more modules). In this case, you'd be able to use the normal javax annotations, though we don't want that to be a required dependency of the API. > @NonNull support (for @NonNullByDefault or similar) > --- > > Key: LOG4J2-1477 > URL: https://issues.apache.org/jira/browse/LOG4J2-1477 > Project: Log4j 2 > Issue Type: Wish > Components: API >Affects Versions: 2.6.2 > Environment: any >Reporter: Bojan Antonović >Assignee: Matt Sicker >Priority: Major > Fix For: 3.0.0 > > > Eclipse (and other tools) offer non-null checks by annotation processing. > One of the possibilities to enable this is to add the annotation > @org.eclipse.jdt.annotation.NonNullByDefault in your package-info.java file. > Example: > @org.eclipse.jdt.annotation.NonNullByDefault > package foo; > A frequent problem is reported when using a logger: > private static final Logger LOGGER = LogManager.getLogger(Bla.class); > for which Eclipse says: > Null type safety (type annotations): The expression of type 'Logger' needs > unchecked conversion to conform to '@NonNull Logger' Bla.java (...) > This can by bypassed by putting a @SuppressWarnings("null") over the > expression, but this has to be done in every class, and may be the *only* > line of code with this workaround. > Problems: > - There are other annotations for non-null (javax.annotation.Nonnull) and > many other frameworks, like the Checker Framework. > - I don't want to be a judge which one to choose. > - Deeper support may require a dependency on Java 8. > - If you want to do it framework wide, this can be a huge task. > - As some tools are not mature (IMHO), it will need experiments. -- This message was sent by Atlassian Jira (v8.20.10#820010)
Re: [I] Java 9 Module name wrong for slf4j 2.x (logging-log4j2)
aschepp commented on issue #1983: URL: https://github.com/apache/logging-log4j2/issues/1983#issuecomment-1821605633 Downgrade to 2.21.1 worked. Thanks for the quick help. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [I] Sync and move Java EE modules to a new repo in `3.x` (logging-log4j2)
vy commented on issue #1966: URL: https://github.com/apache/logging-log4j2/issues/1966#issuecomment-1821571454 * [logging-log4j-jakarta](/apache/logging-log4j-jakarta) repository is created with [a website](https://logging.staged.apache.org/log4j/jakarta) * JEE modules are removed (#1981) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [I] Sync and move Java EE modules to a new repo in `3.x` (logging-log4j2)
vy closed issue #1966: Sync and move Java EE modules to a new repo in `3.x` URL: https://github.com/apache/logging-log4j2/issues/1966 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Delete Java EE and Jakarta EE modules (logging-log4j2)
vy merged PR #1981: URL: https://github.com/apache/logging-log4j2/pull/1981 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Delete Java EE and Jakarta EE modules (logging-log4j2)
vy commented on code in PR #1981: URL: https://github.com/apache/logging-log4j2/pull/1981#discussion_r1401079821 ## log4j-core-test/src/test/java/org/apache/logging/log4j/core/filter/HttpThreadContextMapFilterTest.java: ## @@ -16,183 +16,98 @@ */ package org.apache.logging.log4j.core.filter; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.ok; +import static org.assertj.core.api.Assertions.assertThat; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardCopyOption; -import java.util.Base64; -import java.util.Enumeration; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.apache.logging.log4j.Logger; +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.core.WireMockConfiguration; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.Response; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.logging.log4j.ThreadContext; -import org.apache.logging.log4j.core.Appender; import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.config.Configurator; import org.apache.logging.log4j.core.test.appender.ListAppender; -import org.eclipse.jetty.http.HttpHeader; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.ServerConnector; -import org.eclipse.jetty.servlet.DefaultServlet; -import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.servlet.ServletHolder; -import org.junit.Assert; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; +import org.apache.logging.log4j.core.test.junit.LoggerContextSource; +import org.apache.logging.log4j.core.test.junit.Named; +import org.apache.logging.log4j.spi.ExtendedLogger; import org.junit.jupiter.api.Test; /** - * Unit test for simple App. + * Tests {@link ThreadContextMapFilter} using a WireMock stub. */ -public class HttpThreadContextMapFilterTest implements MutableThreadContextMapFilter.FilterConfigUpdateListener { +public class HttpThreadContextMapFilterTest { -private static final String BASIC = "Basic "; -private static final String expectedCreds = "log4j:log4j"; -private static Server server; -private static final Base64.Decoder decoder = Base64.getDecoder(); -private static int port; -static final String CONFIG = "log4j2-mutableFilter.xml"; -static LoggerContext loggerContext = null; -static final File targetFile = new File("target/test-classes/testConfig.json"); -static final Path target = targetFile.toPath(); -CountDownLatch updated = new CountDownLatch(1); +@Test +@LoggerContextSource("HttpThreadContextMapFilterTest.xml") Review Comment: Fixed in 4838ceba9a098b78c51d7fe16bcd4e208fda85c6. ## log4j-core-test/src/test/java/org/apache/logging/log4j/core/filter/HttpThreadContextMapFilterTest.java: ## @@ -16,183 +16,98 @@ */ package org.apache.logging.log4j.core.filter; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.ok; +import static org.assertj.core.api.Assertions.assertThat; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardCopyOption; -import java.util.Base64; -import java.util.Enumeration; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.apache.logging.log4j.Logger; +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.core.WireMockConfiguration; +import co
Re: [PR] Work towards supporting Java 17 builds (logging-log4j2)
ppkarwasz commented on PR #1964: URL: https://github.com/apache/logging-log4j2/pull/1964#issuecomment-1821560341 @jvz, When you fix the tests under Java 17, can you close #1851 and fix apache/logging-parent#62 ? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [I] Java 9 Module name wrong for slf4j 2.x (logging-log4j2)
ppkarwasz commented on issue #1983: URL: https://github.com/apache/logging-log4j2/issues/1983#issuecomment-1821552286 @aschepp, Thank you for noticing. We use BND to generate both our OSGi and JPMS descriptors. The problem is caused by the multi-release nature of `slf4j-api` 2.x. Our current version of BND does not support MRJs, hence the wrong file-based name ended up in the descriptor. Version `1.7.36` of `log4j-api` used in release 2.21.1 is not an MRJ, so you can downgrade to `log4j-to-slf4j` version 2.21.1 as a workaround. As soon as our [CI build finishes](https://github.com/apache/logging-log4j2/actions/runs/6948583130) a new corrected `2.23.0-SNAPSHOT` version should be available. Can you check if it solves your problem? Feel free to reopen this issue if it doesn't. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [I] Java 9 Module name wrong for slf4j 2.x (logging-log4j2)
ppkarwasz closed issue #1983: Java 9 Module name wrong for slf4j 2.x URL: https://github.com/apache/logging-log4j2/issues/1983 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[I] Java 9 Module name wrong for slf4j 2.x (logging-log4j2)
aschepp opened a new issue, #1983: URL: https://github.com/apache/logging-log4j2/issues/1983 ## Description The module log4j-to-slf4j currently uses the following module-info.class: ``` module org.apache.logging.log4j.to.slf4j { requires java.base; requires org.apache.logging.log4j; requires slf4j-api; exports org.apache.logging.slf4j; provides org.apache.logging.log4j.spi.Provider with org.apache.logging.slf4j.SLF4JProvider; } ``` This only works with slf4j 1.x, because the module name has changed with version 2.x of slf4j, it's now "org.slf4j". https://github.com/qos-ch/slf4j/blob/master/slf4j-api/src/main/java9/module-info.java ## Configuration **Version:** 2.22.0 **Operating system:** Linux/Mac **JDK:** Java 17 ## Logs ``` java.lang.module.FindException: Module slf4j-api not found, required by org.apache.logging.log4j.to.slf4j'. ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Use parameterized logging instead of string concatenation (logging-log4j2)
ppkarwasz merged PR #1982: URL: https://github.com/apache/logging-log4j2/pull/1982 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Bump org.postgresql:postgresql from 42.6.0 to 42.7.0 [logging-log4j-audit]
github-actions[bot] commented on PR #92: URL: https://github.com/apache/logging-log4j-audit/pull/92#issuecomment-1821233504 Changes are applied by CI in 08cbe3a0cf8cd37ab08aed0973e6c73473bc7592 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Bump org.postgresql:postgresql from 42.6.0 to 42.7.0 [logging-log4j-audit]
dependabot[bot] commented on PR #92: URL: https://github.com/apache/logging-log4j-audit/pull/92#issuecomment-1821233608 OK, I won't notify you again about this release, but will get in touch when a new version is available. If you'd rather skip all updates until the next major or minor version, let me know by commenting `@dependabot ignore this major version` or `@dependabot ignore this minor version`. You can also ignore all major, minor, or patch releases for a dependency by adding an [`ignore` condition](https://docs.github.com/en/code-security/supply-chain-security/configuration-options-for-dependency-updates#ignore) with the desired `update_types` to your config file. If you change your mind, just re-open this PR and I'll resolve any conflicts on it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Bump org.postgresql:postgresql from 42.6.0 to 42.7.0 [logging-log4j-audit]
github-actions[bot] closed pull request #92: Bump org.postgresql:postgresql from 42.6.0 to 42.7.0 URL: https://github.com/apache/logging-log4j-audit/pull/92 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[PR] Bump org.postgresql:postgresql from 42.6.0 to 42.7.0 [logging-log4j-audit]
dependabot[bot] opened a new pull request, #92: URL: https://github.com/apache/logging-log4j-audit/pull/92 Bumps [org.postgresql:postgresql](https://github.com/pgjdbc/pgjdbc) from 42.6.0 to 42.7.0. Release notes Sourced from https://github.com/pgjdbc/pgjdbc/releases";>org.postgresql:postgresql's releases. v42.7.0 Changes update website for 42.7.0 https://github.com/davecramer";>@davecramer (https://redirect.github.com/pgjdbc/pgjdbc/issues/3003";>#3003) Update changelog for release 42.7.0 https://github.com/davecramer";>@davecramer (https://redirect.github.com/pgjdbc/pgjdbc/issues/3001";>#3001) Use a switch statement to compare transaction isolation levels and let the database do the toUpper https://github.com/davecramer";>@davecramer (https://redirect.github.com/pgjdbc/pgjdbc/issues/2998";>#2998) feat: support SET statements combining with other queries with semicolon in PreparedStatement https://github.com/ng-galien";>@ng-galien (https://redirect.github.com/pgjdbc/pgjdbc/issues/2973";>#2973) Return correct default from PgDatabaseMetaData.getDefaultTransactionIsolation https://github.com/nvanbenschoten";>@nvanbenschoten (https://redirect.github.com/pgjdbc/pgjdbc/issues/2992";>#2992) only create function if V14 or greater https://github.com/davecramer";>@davecramer (https://redirect.github.com/pgjdbc/pgjdbc/issues/2996";>#2996) Fix problem when calling a procedure returning a refcursor more than 5 times (prepareThreshold) https://github.com/davecramer";>@davecramer (https://redirect.github.com/pgjdbc/pgjdbc/issues/2988";>#2988) chore: add styleCheck Gradle task to report style violations https://github.com/vlsi";>@vlsi (https://redirect.github.com/pgjdbc/pgjdbc/issues/2980";>#2980) Include currentXid in exception message https://github.com/gastaldi";>@gastaldi (https://redirect.github.com/pgjdbc/pgjdbc/issues/2978";>#2978) Deprecate for removal PGPoint.setLocation(java.awt.Point) to cut dependency to java.desktop module https://github.com/desruisseaux";>@desruisseaux (https://redirect.github.com/pgjdbc/pgjdbc/issues/2967";>#2967) feat: return all catalogs for getCatalogs metadata query (https://redirect.github.com/pgjdbc/pgjdbc/issues/2949";>#2949) https://github.com/pip25";>@pip25 (https://redirect.github.com/pgjdbc/pgjdbc/issues/2953";>#2953) fix: add varbit as a basic type inside the TypeInfoCache https://github.com/fqazi";>@fqazi (https://redirect.github.com/pgjdbc/pgjdbc/issues/2960";>#2960) Fix failing tests for version 16. https://github.com/davecramer";>@davecramer (https://redirect.github.com/pgjdbc/pgjdbc/issues/2962";>#2962) fix: allow setting arrays with ANSI type name https://github.com/bremac";>@bremac (https://redirect.github.com/pgjdbc/pgjdbc/issues/2952";>#2952) added ADOPTERS.md https://github.com/davecramer";>@davecramer (https://redirect.github.com/pgjdbc/pgjdbc/issues/2951";>#2951) feat: Use KeepAlive to confirm LSNs https://github.com/decmurphy";>@decmurphy (https://redirect.github.com/pgjdbc/pgjdbc/issues/2941";>#2941) put double ' around log parameter https://github.com/davecramer";>@davecramer (https://redirect.github.com/pgjdbc/pgjdbc/issues/2936";>#2936) Fix Issue https://redirect.github.com/pgjdbc/pgjdbc/issues/2928";>#2928 number of ports not equal to number of servers in datasource https://github.com/davecramer";>@davecramer (https://redirect.github.com/pgjdbc/pgjdbc/issues/2929";>#2929) Use canonical DateStyle name https://github.com/JelteF";>@JelteF (https://redirect.github.com/pgjdbc/pgjdbc/issues/2925";>#2925) un-deprecate SSL_FACTORY_ARG https://github.com/davecramer";>@davecramer (https://redirect.github.com/pgjdbc/pgjdbc/issues/2923";>#2923) Method getFastLong should be able to parse all longs https://github.com/zhurs";>@zhurs (https://redirect.github.com/pgjdbc/pgjdbc/issues/2881";>#2881) fix: typos in info.html https://github.com/maffe";>@maffe (https://redirect.github.com/pgjdbc/pgjdbc/issues/2860";>#2860) bump version for next release https://github.com/davecramer";>@davecramer (https://redirect.github.com/pgjdbc/pgjdbc/issues/2859";>#2859) rename changelog for 42.6.0 to the correct name https://github.com/davecramer";>@davecramer (https://redirect.github.com/pgjdbc/pgjdbc/issues/2858";>#2858) ⬆️ Dependencies fix(deps): update dependency org.codehaus.groovy:groovy-all to v3.0.19 https://github.com/renovate-bot";>@renovate-bot (https://redirect.github.com/pgjdbc/pgjdbc/issues/2993";>#2993) fix(deps): update dependency jacoco to v0.8.11 https://github.com/renovate-bot";>@renovate-bot (https://redirect.github.com/pgjdbc/pgjdbc/issues/2990";>#2990) fix(deps): update dependency checkstyle to v10.12.4 https://github.com/renovate-bot";>@renovate-bot (https://redirect.github.com/pgjdbc/pgjdbc/issues/2989";>#2989) chore(deps): update codecov/codecov-action digest to f4993f1 https://github.com/renovate-bot";>@re
Re: [PR] MDC and NDC availablity no longer depend on APR thread support [logging-log4cxx]
rm5248 commented on code in PR #299: URL: https://github.com/apache/logging-log4cxx/pull/299#discussion_r1400635186 ## src/main/cpp/threadspecificdata.cpp: ## @@ -60,13 +60,16 @@ ThreadSpecificData& ThreadSpecificData::getDataNoThreads() ThreadSpecificData* ThreadSpecificData::getCurrentData() { -#if APR_HAS_THREADS void* pData = NULL; +#if APR_HAS_THREADS Review Comment: should these `#if` be reversed, such that if it has `thread_local` that takes precedence over APR? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Delete Java EE and Jakarta EE modules (logging-log4j2)
ppkarwasz commented on code in PR #1981: URL: https://github.com/apache/logging-log4j2/pull/1981#discussion_r1400552958 ## log4j-core-test/src/test/java/org/apache/logging/log4j/core/filter/HttpThreadContextMapFilterTest.java: ## @@ -16,183 +16,98 @@ */ package org.apache.logging.log4j.core.filter; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.ok; +import static org.assertj.core.api.Assertions.assertThat; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardCopyOption; -import java.util.Base64; -import java.util.Enumeration; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.apache.logging.log4j.Logger; +import com.github.tomakehurst.wiremock.WireMockServer; +import com.github.tomakehurst.wiremock.common.FileSource; +import com.github.tomakehurst.wiremock.core.WireMockConfiguration; +import com.github.tomakehurst.wiremock.extension.Parameters; +import com.github.tomakehurst.wiremock.extension.ResponseTransformer; +import com.github.tomakehurst.wiremock.http.Request; +import com.github.tomakehurst.wiremock.http.Response; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.logging.log4j.ThreadContext; -import org.apache.logging.log4j.core.Appender; import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.config.Configurator; import org.apache.logging.log4j.core.test.appender.ListAppender; -import org.eclipse.jetty.http.HttpHeader; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.ServerConnector; -import org.eclipse.jetty.servlet.DefaultServlet; -import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.servlet.ServletHolder; -import org.junit.Assert; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; +import org.apache.logging.log4j.core.test.junit.LoggerContextSource; +import org.apache.logging.log4j.core.test.junit.Named; +import org.apache.logging.log4j.spi.ExtendedLogger; import org.junit.jupiter.api.Test; /** - * Unit test for simple App. + * Tests {@link ThreadContextMapFilter} using a WireMock stub. */ -public class HttpThreadContextMapFilterTest implements MutableThreadContextMapFilter.FilterConfigUpdateListener { +public class HttpThreadContextMapFilterTest { -private static final String BASIC = "Basic "; -private static final String expectedCreds = "log4j:log4j"; -private static Server server; -private static final Base64.Decoder decoder = Base64.getDecoder(); -private static int port; -static final String CONFIG = "log4j2-mutableFilter.xml"; -static LoggerContext loggerContext = null; -static final File targetFile = new File("target/test-classes/testConfig.json"); -static final Path target = targetFile.toPath(); -CountDownLatch updated = new CountDownLatch(1); +@Test +@LoggerContextSource("HttpThreadContextMapFilterTest.xml") Review Comment: A couple of months ago I introduced a default value for a logger context configuration: if you move the config file to `src/test/resources/org/apache/logging/log4j/core/filter/HttpThreadContextMapFilterTest.xml` (i.e. same package and name as the test), you don't need to provide a value to the `@LoggerContextSource` annotation. ## log4j-core-test/src/test/java/org/apache/logging/log4j/core/filter/HttpThreadContextMapFilterTest.java: ## @@ -16,183 +16,98 @@ */ package org.apache.logging.log4j.core.filter; -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; +import static com.github.tomakehurst.wiremock.client.WireMock.get; +import static com.github.tomakehurst.wiremock.client.WireMock.ok; +import static org.assertj.core.api.Assertions.assertThat; -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardCopyOption; -import java.util.Base64; -import java.util.Enumeration; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletR
Re: [I] [MS4] Modernization #2 (logging-log4j2)
ppkarwasz closed issue #1706: [MS4] Modernization #2 URL: https://github.com/apache/logging-log4j2/issues/1706 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [I] [MS4] Modernization #2 (logging-log4j2)
ppkarwasz commented on issue #1706: URL: https://github.com/apache/logging-log4j2/issues/1706#issuecomment-1820711658 After applying the Palantir formatter and all the [Migrate to Java 11](https://docs.openrewrite.org/recipes/java/migrate/java8tojava11) (Java 11 is the currently agreed baseline for 3.x) OpenRewrite rules to the `main` branch, I consider this task completed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] LOG4J2-3672 Avoid invoking `DateFormatSymbols.getZoneStrings()` in `FastDateParser` (logging-log4j2)
tristantarrant commented on PR #1848: URL: https://github.com/apache/logging-log4j2/pull/1848#issuecomment-1820588317 @vy just to let you know that our application initial heap footprint went down from ~31MB to 25MB (we also disabled initialization of JMX) thanks to this. Thanks again. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Commented] (LOG4J2-1477) @NonNull support (for @NonNullByDefault or similar)
[ https://issues.apache.org/jira/browse/LOG4J2-1477?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17788345#comment-17788345 ] Greg Thomas commented on LOG4J2-1477: - > I can make some aliases in the API to make this simpler to update later on if > needed. So yet another Nullable annotation to add to the list at [https://stackoverflow.com/questions/4963300/which-notnull-java-annotation-should-i-use] ? The Log4J one? It seems to be that perhaps (perhaps) [https://jspecify.dev/] is the way to go. Certainly something I'm keeping an eye on, and seems to have backing from some big players - https://jspecify.dev/about Though of course [https://xkcd.com/927/] applies I guess. > @NonNull support (for @NonNullByDefault or similar) > --- > > Key: LOG4J2-1477 > URL: https://issues.apache.org/jira/browse/LOG4J2-1477 > Project: Log4j 2 > Issue Type: Wish > Components: API >Affects Versions: 2.6.2 > Environment: any >Reporter: Bojan Antonović >Assignee: Matt Sicker >Priority: Major > Fix For: 3.0.0 > > > Eclipse (and other tools) offer non-null checks by annotation processing. > One of the possibilities to enable this is to add the annotation > @org.eclipse.jdt.annotation.NonNullByDefault in your package-info.java file. > Example: > @org.eclipse.jdt.annotation.NonNullByDefault > package foo; > A frequent problem is reported when using a logger: > private static final Logger LOGGER = LogManager.getLogger(Bla.class); > for which Eclipse says: > Null type safety (type annotations): The expression of type 'Logger' needs > unchecked conversion to conform to '@NonNull Logger' Bla.java (...) > This can by bypassed by putting a @SuppressWarnings("null") over the > expression, but this has to be done in every class, and may be the *only* > line of code with this workaround. > Problems: > - There are other annotations for non-null (javax.annotation.Nonnull) and > many other frameworks, like the Checker Framework. > - I don't want to be a judge which one to choose. > - Deeper support may require a dependency on Java 8. > - If you want to do it framework wide, this can be a huge task. > - As some tools are not mature (IMHO), it will need experiments. -- This message was sent by Atlassian Jira (v8.20.10#820010)
Re: [PR] Delete Java EE and Jakarta EE modules (logging-log4j2)
vy commented on code in PR #1981: URL: https://github.com/apache/logging-log4j2/pull/1981#discussion_r1400292319 ## log4j-core-test/src/test/java/org/apache/logging/log4j/core/filter/HttpThreadContextMapFilterTest.java: ## @@ -1,198 +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. - */ -package org.apache.logging.log4j.core.filter; - -import static org.junit.jupiter.api.Assertions.assertNotEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardCopyOption; -import java.util.Base64; -import java.util.Enumeration; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.ThreadContext; -import org.apache.logging.log4j.core.Appender; -import org.apache.logging.log4j.core.LoggerContext; -import org.apache.logging.log4j.core.config.Configurator; -import org.apache.logging.log4j.core.test.appender.ListAppender; -import org.eclipse.jetty.http.HttpHeader; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.ServerConnector; -import org.eclipse.jetty.servlet.DefaultServlet; -import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.servlet.ServletHolder; -import org.junit.Assert; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; - -/** - * Unit test for simple App. - */ -public class HttpThreadContextMapFilterTest implements MutableThreadContextMapFilter.FilterConfigUpdateListener { Review Comment: Rewritten in 577723fb8f85b7280489b9fedcdc0e61c93aa9a1. ## log4j-core-test/src/test/java/org/apache/logging/log4j/core/net/UrlConnectionFactoryTest.java: ## @@ -1,218 +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. - */ -package org.apache.logging.log4j.core.net; - -import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST; -import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR; -import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND; -import static javax.servlet.http.HttpServletResponse.SC_NOT_MODIFIED; -import static javax.servlet.http.HttpServletResponse.SC_OK; -import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.jupiter.api.Assertions.fail; - -import com.sun.management.UnixOperatingSystemMXBean; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.lang.management.ManagementFactory; -import java.lang.management.OperatingSystemMXBean; -import java.net.HttpURLConnection; -import java.net.URI; -import java.net.URL; -import java.nio.file.Files; -import java.util.Base64; -import java.util.Enumeration; -import jav
Re: [PR] Delete Java EE and Jakarta EE modules (logging-log4j2)
vy commented on code in PR #1981: URL: https://github.com/apache/logging-log4j2/pull/1981#discussion_r1400163149 ## log4j-jeromq/pom.xml: ## @@ -30,7 +30,7 @@ ${basedir}/.. Log4j ZeroMQ using JeroMQ Documentation -/log4j-jpa +/log4j-jeromq Review Comment: It is not. But again, we should fix this everywhere and this PR is not the right place. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Delete Java EE and Jakarta EE modules (logging-log4j2)
vy commented on code in PR #1981: URL: https://github.com/apache/logging-log4j2/pull/1981#discussion_r1400162350 ## src/changelog/.3.x.x/remove_jakarta_ee.xml: ## @@ -15,15 +15,12 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - - - Review Comment: Agreed. Though ideally this mass remove-the-license-header operation should be performed separate from this PR. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Delete Java EE and Jakarta EE modules (logging-log4j2)
vy commented on code in PR #1981: URL: https://github.com/apache/logging-log4j2/pull/1981#discussion_r1400160834 ## log4j-distribution/pom.xml: ## @@ -225,30 +225,6 @@ ${project.version} sources - Review Comment: No, it is not. But this is out of scope, I won't fix the distribution in this PR. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Delete Java EE and Jakarta EE modules (logging-log4j2)
vy commented on code in PR #1981: URL: https://github.com/apache/logging-log4j2/pull/1981#discussion_r1400160151 ## log4j-core/src/main/resources/Log4j-config.xsd: ## @@ -647,13 +647,9 @@ - - - Review Comment: Agreed, but this is out of scope. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
Re: [PR] Delete Java EE and Jakarta EE modules (logging-log4j2)
vy commented on code in PR #1981: URL: https://github.com/apache/logging-log4j2/pull/1981#discussion_r1400158583 ## log4j-core-test/src/main/resources/Log4j-config.xsd: ## @@ -647,13 +647,9 @@ - - - Review Comment: I think this concern is out of the scope of this work. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org