Re: [PR] Add option to provide URIs to monitor in addition to the config file [logging-log4j2]
ppkarwasz commented on code in PR #3501: URL: https://github.com/apache/logging-log4j2/pull/3501#discussion_r2110315178 ## log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/api/MonitorResourceComponentBuilder.java: ## @@ -0,0 +1,22 @@ +/* + * 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.config.builder.api; + +/** + * Assembler for constructing MonitorUri Components. + */ +public interface MonitorResourceComponentBuilder extends ComponentBuilder {} Review Comment: Unless I am mistaken, this class and its implementation are no longer used anywhere. Can you remove them? -- 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] Add option to provide URIs to monitor in addition to the config file [logging-log4j2]
MichaelMorrisEst commented on code in PR #3501: URL: https://github.com/apache/logging-log4j2/pull/3501#discussion_r2114474331 ## log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/api/MonitorResourceComponentBuilder.java: ## @@ -0,0 +1,22 @@ +/* + * 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.config.builder.api; + +/** + * Assembler for constructing MonitorUri Components. + */ +public interface MonitorResourceComponentBuilder extends ComponentBuilder {} Review Comment: Yes you are right, no longer needed with the latest changes, removed them now -- 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] Expunge stale entries in InternalLoggerRegistry [logging-log4j2]
ppkarwasz commented on code in PR #3681: URL: https://github.com/apache/logging-log4j2/pull/3681#discussion_r2113701902 ## log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/internal/InternalLoggerRegistryTest.java: ## @@ -0,0 +1,189 @@ +/* + * 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.util.internal; + +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.awaitility.Awaitility.await; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.lang.ref.WeakReference; +import java.lang.reflect.Field; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import org.apache.logging.log4j.core.Logger; +import org.apache.logging.log4j.core.LoggerContext; +import org.apache.logging.log4j.message.MessageFactory; +import org.apache.logging.log4j.message.SimpleMessageFactory; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; + +class InternalLoggerRegistryTest { +private LoggerContext loggerContext; +private InternalLoggerRegistry registry; +private MessageFactory messageFactory; + +@BeforeEach +void setUp(TestInfo testInfo) throws NoSuchFieldException, IllegalAccessException { +loggerContext = new LoggerContext(testInfo.getDisplayName()); +Field registryField = loggerContext.getClass().getDeclaredField("loggerRegistry"); +registryField.setAccessible(true); +registry = (InternalLoggerRegistry) registryField.get(loggerContext); +messageFactory = SimpleMessageFactory.INSTANCE; +} + +@AfterEach +void tearDown() { +if (loggerContext != null) { +loggerContext.stop(); +} +} + +@Test +void testGetLoggerReturnsNullForNonExistentLogger() { +assertNull(registry.getLogger("nonExistent", messageFactory)); +} + +@Test +void testComputeIfAbsentCreatesLogger() { +Logger logger = registry.computeIfAbsent( +"testLogger", messageFactory, (name, factory) -> new MockLogger(loggerContext, name, factory)); +assertNotNull(logger); +assertEquals("testLogger", logger.getName()); +} + +@Test +void testGetLoggerRetrievesExistingLogger() { +Logger logger = registry.computeIfAbsent( +"testLogger", messageFactory, (name, factory) -> new MockLogger(loggerContext, name, factory)); +assertSame(logger, registry.getLogger("testLogger", messageFactory)); +} + +@Test +void testHasLoggerReturnsCorrectStatus() { +assertFalse(registry.hasLogger("testLogger", messageFactory)); +registry.computeIfAbsent( +"testLogger", messageFactory, (name, factory) -> new MockLogger(loggerContext, name, factory)); +assertTrue(registry.hasLogger("testLogger", messageFactory)); +} + +@Test +void testExpungeStaleWeakReferenceEntries() { +String loggerNamePrefix = "testLogger_"; +int numberOfLoggers = 1000; + +for (int i = 0; i < numberOfLoggers; i++) { +Logger logger = registry.computeIfAbsent( +loggerNamePrefix + i, +messageFactory, +(name, factory) -> new MockLogger(loggerContext, name, factory)); +logger.info("Using logger {}", logger.getName()); +} + +await().atMost(10, SECONDS).pollInterval(100, MILLISECONDS).untilAsserted(() -> { +System.gc(); +System.runFinalization(); +registry.computeIfAbsent( +"triggerExpunge", messageFactory, (name, factory) -> new MockLogger(loggerContext, name, fac
[PR] Enable branch protection [logging-log4j-tools]
ppkarwasz opened a new pull request, #191: URL: https://github.com/apache/logging-log4j-tools/pull/191 This change enables the same branch protection that was implemented in `logging-log4j2`. See apache/logging-log4j2#3582 and apache/logging-log4j2#3662 -- 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] v3.1.0 is breaking rolling logfiles usage (logging-log4net)
maedula commented on issue #250: URL: https://github.com/apache/logging-log4net/issues/250#issuecomment-2918581607 While thinking about it and to be a lil more precise for the condition where incorrect overwriting log files happens if the logging process is being killed and restarted. I'm expecting that the logging of all previous instances is available. That's at least how my configuration behaved up to v3.0.4. Now if I kill and restart the process ten times, it will just give me log.log and log.1.log (which gets overwritten constantly). Previously it was log.log, log.1.log, log.2.log, ..., log.9.log. Rolling during runtime of a process isn't an issue (i assume that at least) -- 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] DirectWriteRolloverStrategy and TimeBasedTriggeringPolicy [logging-log4j2]
Class-New commented on issue #3697: URL: https://github.com/apache/logging-log4j2/issues/3697#issuecomment-2918395259 SizeBasedTriggeringPolicy的size大小限制为5k 5.9K common.85.l0g 6.2K common.86.l0g 3.2K common.87.log -- 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] v3.1.0 is breaking rolling logfiles usage (logging-log4net)
gdziadkiewicz commented on issue #250: URL: https://github.com/apache/logging-log4net/issues/250#issuecomment-2918617885 > While thinking about it and to be a lil more precise for the condition where incorrect overwriting log files happens if the logging process is being killed and restarted. I'm expecting that the logging of all previous instances is available. That's at least how my configuration behaved up to v3.0.4. Now if I kill and restart the process ten times, it will just give me log.log and log.1.log (which gets overwritten constantly). Previously it was log.log, log.1.log, log.2.log, ..., log.9.log. Rolling during runtime of a process isn't an issue (i assume that at least) This may be exactly the part I was missing in my repro. I will revisit it today. Thanks for the additional details! -- 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] log4j-docgen: Support boxed and native Java types in XSD generation [logging-log4j-tools]
ppkarwasz opened a new pull request, #190: URL: https://github.com/apache/logging-log4j-tools/pull/190 Previously, `SchemaGenerator` did not handle configuration attributes with boxed types (e.g., `Integer`, `Boolean`), leading to their omission from the generated XSD schema. This update introduces: * Support for boxed Java types as configuration attributes. * Improved handling of other native Java types that map to XML built-in data types (e.g., `BigDecimal`, `URL`). These enhancements ensure that all relevant configuration attributes are accurately represented in the schema. Fixes: #135 -- 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] Expunge stale entries in InternalLoggerRegistry [logging-log4j2]
jhl221123 commented on code in PR #3681: URL: https://github.com/apache/logging-log4j2/pull/3681#discussion_r2113606606 ## log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/internal/InternalLoggerRegistryTest.java: ## @@ -0,0 +1,189 @@ +/* + * 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.util.internal; + +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static java.util.concurrent.TimeUnit.SECONDS; +import static org.awaitility.Awaitility.await; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import java.lang.ref.WeakReference; +import java.lang.reflect.Field; +import java.util.Map; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import org.apache.logging.log4j.core.Logger; +import org.apache.logging.log4j.core.LoggerContext; +import org.apache.logging.log4j.message.MessageFactory; +import org.apache.logging.log4j.message.SimpleMessageFactory; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; + +class InternalLoggerRegistryTest { +private LoggerContext loggerContext; +private InternalLoggerRegistry registry; +private MessageFactory messageFactory; + +@BeforeEach +void setUp(TestInfo testInfo) throws NoSuchFieldException, IllegalAccessException { +loggerContext = new LoggerContext(testInfo.getDisplayName()); +Field registryField = loggerContext.getClass().getDeclaredField("loggerRegistry"); +registryField.setAccessible(true); +registry = (InternalLoggerRegistry) registryField.get(loggerContext); +messageFactory = SimpleMessageFactory.INSTANCE; +} + +@AfterEach +void tearDown() { +if (loggerContext != null) { +loggerContext.stop(); +} +} + +@Test +void testGetLoggerReturnsNullForNonExistentLogger() { +assertNull(registry.getLogger("nonExistent", messageFactory)); +} + +@Test +void testComputeIfAbsentCreatesLogger() { +Logger logger = registry.computeIfAbsent( +"testLogger", messageFactory, (name, factory) -> new MockLogger(loggerContext, name, factory)); +assertNotNull(logger); +assertEquals("testLogger", logger.getName()); +} + +@Test +void testGetLoggerRetrievesExistingLogger() { +Logger logger = registry.computeIfAbsent( +"testLogger", messageFactory, (name, factory) -> new MockLogger(loggerContext, name, factory)); +assertSame(logger, registry.getLogger("testLogger", messageFactory)); +} + +@Test +void testHasLoggerReturnsCorrectStatus() { +assertFalse(registry.hasLogger("testLogger", messageFactory)); +registry.computeIfAbsent( +"testLogger", messageFactory, (name, factory) -> new MockLogger(loggerContext, name, factory)); +assertTrue(registry.hasLogger("testLogger", messageFactory)); +} + +@Test +void testExpungeStaleWeakReferenceEntries() { +String loggerNamePrefix = "testLogger_"; +int numberOfLoggers = 1000; + +for (int i = 0; i < numberOfLoggers; i++) { +Logger logger = registry.computeIfAbsent( +loggerNamePrefix + i, +messageFactory, +(name, factory) -> new MockLogger(loggerContext, name, factory)); +logger.info("Using logger {}", logger.getName()); +} + +await().atMost(10, SECONDS).pollInterval(100, MILLISECONDS).untilAsserted(() -> { +System.gc(); +System.runFinalization(); +registry.computeIfAbsent( +"triggerExpunge", messageFactory, (name, factory) -> new MockLogger(loggerContext, name, fac