Re: [I] v3.1.0 - Exception with RollingFileAppender when files are already present (logging-log4net)
gdziadkiewicz commented on issue #244: URL: https://github.com/apache/logging-log4net/issues/244#issuecomment-2915291286 @moeash is right. This is reproducible under the classic .NET Framework, but not under .NET 8. I drafted a fix for this, but encountered an error related to closing files. I will share more today. -- 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] Fix #244 (logging-log4net)
gdziadkiewicz opened a new pull request, #251: URL: https://github.com/apache/logging-log4net/pull/251 (no comment) -- 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] log4j-bom contains unrelated dependencies [logging-log4j2]
vy closed issue #3692: log4j-bom contains unrelated dependencies URL: https://github.com/apache/logging-log4j2/issues/3692 -- 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] DirectWriteRolloverStrategy and TimeBasedTriggeringPolicy [logging-log4j2]
Class-New opened a new issue, #3697: URL: https://github.com/apache/logging-log4j2/issues/3697 DirectWriteRolloverStrategy and TimeBasedTriggeringPolicy use, found that more than limit the size of the file size -- 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] Add `collectionName` and `databaseName` attributes to `MongoDbProvider` [logging-log4j2]
ppkarwasz commented on PR #3322: URL: https://github.com/apache/logging-log4j2/pull/3322#issuecomment-2918440584 > With 24 files changed here, I might have missed the answer to the following questions, so apologies if I did (AFK, phone): It appears that test configuration files have been updated to use the new format, but how is the classic format tested then? The new format should be tested in new test fixtures to guarantee that nothing will break existing user configurations. The classic configuration format (where `databaseName` and `collectionName` are inferred from the connection string) is still tested via the unit test [`MongoDbProviderTest`](https://github.com/apache/logging-log4j2/blob/9dcff7c551661f905f82bb74c1f1eb2141d3012f/log4j-mongodb/src/test/java/org/apache/logging/log4j/mongodb/MongoDbProviderTest.java). This test explicitly covers the fallback behavior, ensuring that default values are correctly derived when those parameters are not explicitly set. I believe this provides sufficient coverage to confirm that existing user configurations remain supported. > The site docs mention that the new format overrides the old one (good doc change) but does the Javadoc reflect that as well? Great point — thanks for catching that! 👍 The main purpose of this PR is to address a mismatch between the Javadoc for `ConnectionString`, which allows specifying a collection name, and the broader MongoDB documentation, which doesn’t cover that case. We should definitely ensure that our Javadoc clearly reflects the changes in the configuration format. BTW: the Log4j plugin reference is auto-generated from the Javadoc of the builder classes. So updating the Javadoc will directly improve the plugin reference too. -- 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-2918486485 @gdziadkiewicz i will try to create a small sample project to reproduce the condition by next week. For now you can also close this ticket if you wish. -- 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] log4j-bom contains unrelated dependencies [logging-log4j2]
vy commented on issue #3692: URL: https://github.com/apache/logging-log4j2/issues/3692#issuecomment-2916894003 @idelpivnitskiy, thanks for taking to time to report. AFAIU, this issue is a duplicate of #3066 and has already been fixed. The fix will be released with the next Log4j version `2.25.0`. -- 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-2916971857 Hi @maedula, I didn't manage to reproduce your issue with the config you provided on net48 and net8, on a Windows 11 machine. Can you share more about your configuration? -- 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 - Exception with RollingFileAppender when files are already present (logging-log4net)
gdziadkiewicz commented on issue #244: URL: https://github.com/apache/logging-log4net/issues/244#issuecomment-2917019138 The fix is in the linked PR. I'm getting the weird error while using net48 and this approach of `ActivateOptions` configuration. -- 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] Validate scripts in global `` container [logging-log4j2]
injae-kim commented on issue #3176: URL: https://github.com/apache/logging-log4j2/issues/3176#issuecomment-2916308595 Fix PR: https://github.com/apache/logging-log4j2/pull/3691 -- 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]
vy commented on code in PR #3681: URL: https://github.com/apache/logging-log4j2/pull/3681#discussion_r2112119708 ## log4j-core/src/main/java/org/apache/logging/log4j/core/util/internal/InternalLoggerRegistry.java: ## @@ -53,13 +58,43 @@ public final class InternalLoggerRegistry { new WeakHashMap<>(); private final ReadWriteLock lock = new ReentrantReadWriteLock(); - private final Lock readLock = lock.readLock(); - private final Lock writeLock = lock.writeLock(); +// ReferenceQueue to track stale WeakReferences +private final ReferenceQueue staleLoggerRefs = new ReferenceQueue<>(); + public InternalLoggerRegistry() {} +/** + * Expunges stale entries for logger references and message factories. + */ +private void expungeStaleEntries() { +Reference loggerRef = staleLoggerRefs.poll(); Review Comment: ```suggestion final Reference loggerRef = staleLoggerRefs.poll(); ``` ## log4j-core/src/main/java/org/apache/logging/log4j/core/util/internal/InternalLoggerRegistry.java: ## @@ -53,13 +58,43 @@ public final class InternalLoggerRegistry { new WeakHashMap<>(); private final ReadWriteLock lock = new ReentrantReadWriteLock(); - private final Lock readLock = lock.readLock(); - private final Lock writeLock = lock.writeLock(); +// ReferenceQueue to track stale WeakReferences +private final ReferenceQueue staleLoggerRefs = new ReferenceQueue<>(); + public InternalLoggerRegistry() {} +/** + * Expunges stale entries for logger references and message factories. + */ +private void expungeStaleEntries() { +Reference loggerRef = staleLoggerRefs.poll(); + +if (loggerRef != null) { +writeLock.lock(); +try { +while (staleLoggerRefs.poll() != null) { +// Clear refQueue +} + +Iterator>>> outerIt = +loggerRefByNameByMessageFactory.entrySet().iterator(); +while (outerIt.hasNext()) { +Map.Entry>> outerEntry = outerIt.next(); +Map> innerMap = outerEntry.getValue(); +innerMap.values().removeIf(weakRef -> weakRef.get() == null); +if (innerMap.isEmpty()) { +outerIt.remove(); +} +} Review Comment: Could you use naming that is coherent with the origin, please? 1. `outerIt` -> `loggerRefByNameByMessageFactoryEntryIt` 2. `outerEntry` -> `loggerRefByNameByMessageFactoryEntry` 3. `innerMap` -> `loggerRefByName` 4. Use `final` modifiers wherever applicable ## log4j-core/src/main/java/org/apache/logging/log4j/core/util/internal/InternalLoggerRegistry.java: ## @@ -70,6 +105,8 @@ public InternalLoggerRegistry() {} public @Nullable Logger getLogger(final String name, final MessageFactory messageFactory) { requireNonNull(name, "name"); requireNonNull(messageFactory, "messageFactory"); +expungeStaleEntries(); // Clean up before retrieving Review Comment: ```suggestion expungeStaleEntries(); ``` ## log4j-core-test/src/test/java/org/apache/logging/log4j/core/util/internal/InternalLoggerRegistryTest.java: ## Review Comment: Can you use `final` modifier for variables wherever applicable, please? ## 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 stati