Re: Feature proposal for a new Filter result: Throw

2024-10-09 Thread Gary Gregory
Hi Ralph, Thank you for taking a peek. I either did not explain myself clearly or in enough detail as I don't feel you fully grasped what I proposed ;-) "Secondly, I don’t like that the only criteria it is able to use to determine whether to throw an exception is the log level." It is _not_ onl

Re: Feature proposal for a new Filter result: Throw

2024-10-09 Thread Gary Gregory
Hi Volkan, Thank you for your review. Later, I would like to have our whole build check all tests for Hibernate warnings. Today, I'm taking a first step. The second step is to have another Maven module's tests perform this check. Recasting the solution as a JUnit 5 extension is a good idea, but

Feature proposal for a new Filter result: Throw

2024-10-09 Thread Gary D. Gregory
Hi All: As a user, I want to programmatically configure Log4j to throw an exception when a specific component logs a WARN event. Background: I am working with a large and complex stack that include Hibernate in the mix. I just fixed a bug that, that as a side-effect, caused Hibernate to log WA

Re: Adding to Logging KEYS file

2024-10-09 Thread Piotr P. Karwasz
Hi Volkan, On Wed, 9 Oct 2024 at 16:46, Volkan Yazıcı wrote: > > Piotr, note that the build must be reproducible > for > CI-based signing. If this is not the case for Log4cxx, could you also > address that in your PR, pleas

Re: Feature proposal for a new Filter result: Throw

2024-10-09 Thread Volkan Yazıcı
Can you solve your problem by writing a JUnit extension (or `@BeforeAll`/`@AfterAll`) that registers your custom filter to the active logger context and removes it after the test? That is, @FailOnLog4jEvent(level = Level.WARN, namePrefix = "org.hibernate.") class SomeHibernateTest { // ... `@T

Re: Feature proposal for a new Filter result: Throw

2024-10-09 Thread Gary D. Gregory
Typo, the new code would be: private static final Filter THROWING_FILTER = ThresholdFilter.createFilter(Level.WARN, Result.THROW, Result.NEUTRAL); Sorry about that. Gary On 2024/10/09 14:34:15 "Gary D. Gregory" wrote: > Hi All: > > As a user, I want to programmatically configure Log4j to thro

Re: Feature proposal for a new Filter result: Throw

2024-10-09 Thread Gary Gregory
Hi Ralph, I'll try again: As mentioned, I don't want to have to write this custom filter in the first place. I want to write: @SuppressWarnings("resource") @BeforeAll static void beforeAddFilter() { LoggerContext.getContext(false).getLogger("org.hibernate").addFilter(ThresholdFilte

Re: Adding to Logging KEYS file

2024-10-09 Thread Volkan Yazıcı
Piotr, note that the build must be reproducible for CI-based signing. If this is not the case for Log4cxx, could you also address that in your PR, please? On Wed, Oct 9, 2024 at 9:09 AM Piotr P. Karwasz wrote: > On Wed, 9

Re: Feature proposal for a new Filter result: Throw

2024-10-09 Thread Ralph Goers
This just feels wrong. Filters are for determining whether log events should be logged. This Filter doesn’t have anything to do with that. It is more like an interceptor. Secondly, I don’t like that the only criteria it is able to use to determine whether to throw an exception is the log level

Re: Feature proposal for a new Filter result: Throw

2024-10-09 Thread Ralph Goers
Yeah, you lost me. Your code has private Result filter(final Level testLevel) { if (testLevel.isMoreSpecificThan(this.level)) { throw new FilterLoggingException(Objects.toString(testLevel)); } return onMismatch; } This isn’t returning a new type of Result, i

Re: Adding to Logging KEYS file

2024-10-09 Thread Piotr P. Karwasz
Hi Stephen, On Wed, 9 Oct 2024 at 09:09, Piotr P. Karwasz wrote: > [1] > https://github.com/apache/logging-parent/blob/428d9ede494f54358c6f004b07f7e40f8f33d3ab/.github/workflows/merge-dependabot-reusable.yaml#L70-L79 The `deploy-release-reusable` workflow[1] should be a better example on how we

Re: Adding to Logging KEYS file

2024-10-09 Thread Piotr P. Karwasz
On Wed, 9 Oct 2024 at 08:36, Stephen Webb wrote: > > That would be much simpler. I was not aware that option was available. Is > there an example I can copy? We use `actions/setup-java` in our workflows[1], which can also install a GPG key on the Github runner (and clears it when the action ends/