This is an automated email from the ASF dual-hosted git repository.

tv pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-jcs.git

commit 6b57c14241260f7234e4a28dde1237328ad6de8e
Author: Thomas Vandahl <[email protected]>
AuthorDate: Thu Feb 12 22:35:41 2026 +0100

    Add logging configuration to modules
---
 .../apache/commons/jcs4/admin/CacheRegionInfo.java |  3 +--
 .../apache/commons/jcs4/admin/JCSAdminBean.java    |  2 +-
 .../commons/jcs4/TestLogConfigurationUtil.java     |  4 +--
 .../auxiliary/disk/AbstractDiskCacheUnitTest.java  |  4 +--
 .../auxiliary/remote/RemoteCacheClientTester.java  |  2 +-
 commons-jcs4-jcache-extras/pom.xml                 | 19 ++++++++++++++
 .../jcache/extras/loader/CompositeCacheLoader.java |  3 ++-
 .../jcache/extras/writer/CompositeCacheWriter.java |  3 ++-
 .../extras/loader/CacheLoaderAdapterTest.java      |  5 +++-
 .../src/test/resources/logging.properties          | 27 ++++++++++++++++++++
 commons-jcs4-jcache-openjpa/pom.xml                | 19 ++++++++++++++
 .../jcache/openjpa/OpenJPAJCacheDataCacheTest.java | 29 ++++++++++++----------
 .../src/test/resources/logging.properties          | 27 ++++++++++++++++++++
 commons-jcs4-jcache-tck/pom.xml                    | 15 +++++++++++
 .../src/test/resources/logging.properties          | 27 ++++++++++++++++++++
 commons-jcs4-jcache/pom.xml                        | 14 +++++++++++
 .../src/test/resources/logging.properties          | 27 ++++++++++++++++++++
 17 files changed, 206 insertions(+), 24 deletions(-)

diff --git 
a/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/CacheRegionInfo.java
 
b/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/CacheRegionInfo.java
index 09a0402b..cdb2de27 100644
--- 
a/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/CacheRegionInfo.java
+++ 
b/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/CacheRegionInfo.java
@@ -1,7 +1,6 @@
 package org.apache.commons.jcs4.admin;
 
 import org.apache.commons.jcs4.engine.CacheStatus;
-import org.apache.commons.jcs4.engine.stats.behavior.IStats;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -36,7 +35,7 @@ public record CacheRegionInfo(
     CacheStatus cacheStatus,
 
     /** The statistics of the cache region */
-    IStats cacheStatistics,
+    String cacheStatistics,
 
     /** The number of memory hits in the cache region */
     long hitCountRam,
diff --git 
a/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/JCSAdminBean.java
 
b/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/JCSAdminBean.java
index 7316b427..38a00d20 100644
--- 
a/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/JCSAdminBean.java
+++ 
b/commons-jcs4-core/src/main/java/org/apache/commons/jcs4/admin/JCSAdminBean.java
@@ -100,7 +100,7 @@ public class JCSAdminBean implements JCSJMXBean
                     cache.getCacheName(),
                     cache.getSize(),
                     cache.getStatus(),
-                    cache.getStatistics(),
+                    cache.getStatistics().toString(),
                     cache.getHitCountRam(),
                     cache.getHitCountAux(),
                     cache.getMissCountNotFound(),
diff --git 
a/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/TestLogConfigurationUtil.java
 
b/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/TestLogConfigurationUtil.java
index 9d1fc1d1..eb5f438f 100644
--- 
a/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/TestLogConfigurationUtil.java
+++ 
b/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/TestLogConfigurationUtil.java
@@ -52,9 +52,9 @@ public class TestLogConfigurationUtil
         public void publish(final LogRecord record)
         {
             final StringBuilder sb = new StringBuilder();
-            sb.append(record.getMillis())
+            sb.append(record.getInstant())
               .append(" - ")
-              .append(record.getSourceClassName())
+              .append(record.getLoggerName())
               .append("#")
               .append(record.getSourceMethodName())
               .append(" - ")
diff --git 
a/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/auxiliary/disk/AbstractDiskCacheUnitTest.java
 
b/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/auxiliary/disk/AbstractDiskCacheUnitTest.java
index 52a21f90..cfcc7c13 100644
--- 
a/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/auxiliary/disk/AbstractDiskCacheUnitTest.java
+++ 
b/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/auxiliary/disk/AbstractDiskCacheUnitTest.java
@@ -270,10 +270,10 @@ class AbstractDiskCacheUnitTest
         // DO WORK
         diskCache.removeAll();
         final String result = stringWriter.toString();
-        System.out.println(result);
+        // System.out.println(result);
 
         // VERIFY
-        assertTrue( result.indexOf( "set to false" ) != -1, "Should say not 
allowed." );
+        assertTrue( result.indexOf( "allowRemoveAll is set to false" ) != -1, 
"Should say not allowed." );
         assertNotNull( diskCache.get( key ), "Item should be in the map." );
     }
 
diff --git 
a/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/auxiliary/remote/RemoteCacheClientTester.java
 
b/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/auxiliary/remote/RemoteCacheClientTester.java
index aa620677..f89929f7 100644
--- 
a/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/auxiliary/remote/RemoteCacheClientTester.java
+++ 
b/commons-jcs4-core/src/test/java/org/apache/commons/jcs4/auxiliary/remote/RemoteCacheClientTester.java
@@ -167,7 +167,7 @@ public class RemoteCacheClientTester
             // Export this remote object to make it available to receive
             // incoming calls,
             // using an anonymous port.
-            UnicastRemoteObject.exportObject( this );
+            UnicastRemoteObject.exportObject(this, 0);
         }
         catch ( final ExportException e )
         {
diff --git a/commons-jcs4-jcache-extras/pom.xml 
b/commons-jcs4-jcache-extras/pom.xml
index 522aea5c..8c6ce281 100644
--- a/commons-jcs4-jcache-extras/pom.xml
+++ b/commons-jcs4-jcache-extras/pom.xml
@@ -83,6 +83,25 @@
       <scope>test</scope>
     </dependency>
   </dependencies>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>default-test</id>
+            <configuration>
+              <systemPropertyVariables>
+                
<java.util.logging.config.file>${basedir}/src/test/resources/logging.properties</java.util.logging.config.file>
+              </systemPropertyVariables>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
   <properties>
     
<commons.module.name>org.apache.commons.jcs4.jcache.extras</commons.module.name>
     <!-- project.build.outputTimestamp is managed by Maven plugins, see 
https://maven.apache.org/guides/mini/guide-reproducible-builds.html -->
diff --git 
a/commons-jcs4-jcache-extras/src/main/java/org/apache/commons/jcs4/jcache/extras/loader/CompositeCacheLoader.java
 
b/commons-jcs4-jcache-extras/src/main/java/org/apache/commons/jcs4/jcache/extras/loader/CompositeCacheLoader.java
index 4a902437..75798766 100644
--- 
a/commons-jcs4-jcache-extras/src/main/java/org/apache/commons/jcs4/jcache/extras/loader/CompositeCacheLoader.java
+++ 
b/commons-jcs4-jcache-extras/src/main/java/org/apache/commons/jcs4/jcache/extras/loader/CompositeCacheLoader.java
@@ -36,6 +36,7 @@ public class CompositeCacheLoader<K, V> implements 
CacheLoader<K, V>, Closeable,
     private static final long serialVersionUID = 5636608842581992435L;
     private final CacheLoader<K, V>[] delegates;
 
+    @SafeVarargs
     public CompositeCacheLoader(final CacheLoader<K, V>... delegates)
     {
         this.delegates = delegates;
@@ -44,7 +45,7 @@ public class CompositeCacheLoader<K, V> implements 
CacheLoader<K, V>, Closeable,
     @Override
     public void close() throws IOException
     {
-        Closeables.close(delegates);
+        Closeables.close((Object[]) delegates);
     }
 
     @Override
diff --git 
a/commons-jcs4-jcache-extras/src/main/java/org/apache/commons/jcs4/jcache/extras/writer/CompositeCacheWriter.java
 
b/commons-jcs4-jcache-extras/src/main/java/org/apache/commons/jcs4/jcache/extras/writer/CompositeCacheWriter.java
index f55be93c..f9eba2a6 100644
--- 
a/commons-jcs4-jcache-extras/src/main/java/org/apache/commons/jcs4/jcache/extras/writer/CompositeCacheWriter.java
+++ 
b/commons-jcs4-jcache-extras/src/main/java/org/apache/commons/jcs4/jcache/extras/writer/CompositeCacheWriter.java
@@ -34,6 +34,7 @@ public class CompositeCacheWriter<K, V> implements 
CacheWriter<K, V>, Closeable,
     private static final long serialVersionUID = -3305787850424123811L;
     private final CacheWriter<K, V>[] writers;
 
+    @SafeVarargs
     public CompositeCacheWriter(final CacheWriter<K, V>... writers)
     {
         this.writers = writers;
@@ -42,7 +43,7 @@ public class CompositeCacheWriter<K, V> implements 
CacheWriter<K, V>, Closeable,
     @Override
     public void close() throws IOException
     {
-        Closeables.close(writers);
+        Closeables.close((Object[]) writers);
     }
 
     @Override
diff --git 
a/commons-jcs4-jcache-extras/src/test/java/org/apache/commons/jcs4/jcache/extras/loader/CacheLoaderAdapterTest.java
 
b/commons-jcs4-jcache-extras/src/test/java/org/apache/commons/jcs4/jcache/extras/loader/CacheLoaderAdapterTest.java
index d87c6699..d65a0a2b 100644
--- 
a/commons-jcs4-jcache-extras/src/test/java/org/apache/commons/jcs4/jcache/extras/loader/CacheLoaderAdapterTest.java
+++ 
b/commons-jcs4-jcache-extras/src/test/java/org/apache/commons/jcs4/jcache/extras/loader/CacheLoaderAdapterTest.java
@@ -38,7 +38,10 @@ import org.junit.jupiter.api.extension.ExtendWith;
 public class CacheLoaderAdapterTest
 {
     private final AtomicInteger count = new AtomicInteger();
-    private final Configuration<?, ?> config = new 
MutableConfiguration<String, 
String>().setStoreByValue(false).setReadThrough(true).setCacheLoaderFactory(new 
CacheLoaderAdapter<String, String>()
+    private final Configuration<?, ?> config = new 
MutableConfiguration<String, String>()
+            .setStoreByValue(false)
+            .setReadThrough(true)
+            .setCacheLoaderFactory(new CacheLoaderAdapter<String, String>()
     {
         private static final long serialVersionUID = 5824701188219321027L;
 
diff --git a/commons-jcs4-jcache-extras/src/test/resources/logging.properties 
b/commons-jcs4-jcache-extras/src/test/resources/logging.properties
new file mode 100644
index 00000000..a8afd405
--- /dev/null
+++ b/commons-jcs4-jcache-extras/src/test/resources/logging.properties
@@ -0,0 +1,27 @@
+# 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
+#
+#   https://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.
+handlers=java.util.logging.FileHandler
+
+.level = INFO
+
+java.util.logging.FileHandler.level=INFO
+java.util.logging.FileHandler.pattern=target/jcache-extras-logging-%g.log
+java.util.logging.FileHandler.limit = 100000
+java.util.logging.FileHandler.count = 2
+java.util.logging.FileHandler.append=true
+java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
+java.util.logging.SimpleFormatter.format=[%1$tF %1$tT] %3$s [%4$-7s] %5$s %n
diff --git a/commons-jcs4-jcache-openjpa/pom.xml 
b/commons-jcs4-jcache-openjpa/pom.xml
index 6c154d4a..af291d79 100644
--- a/commons-jcs4-jcache-openjpa/pom.xml
+++ b/commons-jcs4-jcache-openjpa/pom.xml
@@ -75,6 +75,25 @@
     </dependency>
   </dependencies>
 
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>default-test</id>
+            <configuration>
+              <systemPropertyVariables>
+                
<java.util.logging.config.file>${basedir}/src/test/resources/logging.properties</java.util.logging.config.file>
+              </systemPropertyVariables>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+  
   <properties>
     
<commons.module.name>org.apache.commons.jcs4.jcache.openjpa</commons.module.name>
     <!-- project.build.outputTimestamp is managed by Maven plugins, see 
https://maven.apache.org/guides/mini/guide-reproducible-builds.html -->
diff --git 
a/commons-jcs4-jcache-openjpa/src/test/java/org/apache/commons/jcs4/jcache/openjpa/OpenJPAJCacheDataCacheTest.java
 
b/commons-jcs4-jcache-openjpa/src/test/java/org/apache/commons/jcs4/jcache/openjpa/OpenJPAJCacheDataCacheTest.java
index f5d9b9d4..ff107ffe 100644
--- 
a/commons-jcs4-jcache-openjpa/src/test/java/org/apache/commons/jcs4/jcache/openjpa/OpenJPAJCacheDataCacheTest.java
+++ 
b/commons-jcs4-jcache-openjpa/src/test/java/org/apache/commons/jcs4/jcache/openjpa/OpenJPAJCacheDataCacheTest.java
@@ -68,20 +68,23 @@ class OpenJPAJCacheDataCacheTest
     }
 
     private static final Properties props = new Properties()
-    {private static final long serialVersionUID = 498881935058549341L;
-
     {
-        setProperty("openjpa.MetaDataFactory", "jpa(Types=" + 
MyEntity.class.getName() + ")");
-        setProperty("openjpa.ConnectionDriverName", 
EmbeddedDriver.class.getName());
-        setProperty("openjpa.ConnectionURL", 
"jdbc:derby:memory:test;create=true");
-        setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema");
-        setProperty("openjpa.DataCacheManager", "jcache");
-        setProperty("openjpa.RuntimeUnenhancedClasses", "supported");
-
-        // implicit
-        // setProperty("openjpa.DataCache", "jcache");
-        // setProperty("openjpa.QueryCache", "jcache");
-    }};
+        private static final long serialVersionUID = 498881935058549341L;
+
+        {
+            setProperty("openjpa.MetaDataFactory", "jpa(Types=" + 
MyEntity.class.getName() + ")");
+            setProperty("openjpa.ConnectionDriverName", 
EmbeddedDriver.class.getName());
+            setProperty("openjpa.ConnectionURL", 
"jdbc:derby:memory:test;create=true");
+            setProperty("openjpa.jdbc.SynchronizeMappings", "buildSchema");
+            setProperty("openjpa.DataCacheManager", "jcache");
+            setProperty("openjpa.RuntimeUnenhancedClasses", "supported");
+            setProperty("openjpa.Log", "none");
+
+            // implicit
+            // setProperty("openjpa.DataCache", "jcache");
+            // setProperty("openjpa.QueryCache", "jcache");
+        }
+    };
 
     @Test
     void testEntity()
diff --git a/commons-jcs4-jcache-openjpa/src/test/resources/logging.properties 
b/commons-jcs4-jcache-openjpa/src/test/resources/logging.properties
new file mode 100644
index 00000000..a85495b6
--- /dev/null
+++ b/commons-jcs4-jcache-openjpa/src/test/resources/logging.properties
@@ -0,0 +1,27 @@
+# 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
+#
+#   https://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.
+handlers=java.util.logging.FileHandler
+
+.level = INFO
+
+java.util.logging.FileHandler.level=INFO
+java.util.logging.FileHandler.pattern=target/jcache-openjpa-logging-%g.log
+java.util.logging.FileHandler.limit = 100000
+java.util.logging.FileHandler.count = 2
+java.util.logging.FileHandler.append=true
+java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
+java.util.logging.SimpleFormatter.format=[%1$tF %1$tT] %3$s [%4$-7s] %5$s %n
diff --git a/commons-jcs4-jcache-tck/pom.xml b/commons-jcs4-jcache-tck/pom.xml
index ccd31324..3703891e 100644
--- a/commons-jcs4-jcache-tck/pom.xml
+++ b/commons-jcs4-jcache-tck/pom.xml
@@ -147,6 +147,21 @@
           <skip>true</skip>
         </configuration>
       </plugin>
+
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>default-test</id>
+            <configuration>
+              <systemPropertyVariables>
+                
<java.util.logging.config.file>${basedir}/src/test/resources/logging.properties</java.util.logging.config.file>
+              </systemPropertyVariables>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 
diff --git a/commons-jcs4-jcache-tck/src/test/resources/logging.properties 
b/commons-jcs4-jcache-tck/src/test/resources/logging.properties
new file mode 100644
index 00000000..3afe53cd
--- /dev/null
+++ b/commons-jcs4-jcache-tck/src/test/resources/logging.properties
@@ -0,0 +1,27 @@
+# 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
+#
+#   https://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.
+handlers=java.util.logging.FileHandler
+
+.level = INFO
+
+java.util.logging.FileHandler.level=INFO
+java.util.logging.FileHandler.pattern=target/jcache-tck-logging-%g.log
+java.util.logging.FileHandler.limit = 100000
+java.util.logging.FileHandler.count = 2
+java.util.logging.FileHandler.append=true
+java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
+java.util.logging.SimpleFormatter.format=[%1$tF %1$tT] %3$s [%4$-7s] %5$s %n
diff --git a/commons-jcs4-jcache/pom.xml b/commons-jcs4-jcache/pom.xml
index 5b6629a0..125dbeed 100644
--- a/commons-jcs4-jcache/pom.xml
+++ b/commons-jcs4-jcache/pom.xml
@@ -67,6 +67,20 @@
 
   <build>
     <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>default-test</id>
+            <configuration>
+              <systemPropertyVariables>
+                
<java.util.logging.config.file>${basedir}/src/test/resources/logging.properties</java.util.logging.config.file>
+              </systemPropertyVariables>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
diff --git a/commons-jcs4-jcache/src/test/resources/logging.properties 
b/commons-jcs4-jcache/src/test/resources/logging.properties
new file mode 100644
index 00000000..f1613770
--- /dev/null
+++ b/commons-jcs4-jcache/src/test/resources/logging.properties
@@ -0,0 +1,27 @@
+# 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
+#
+#   https://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.
+handlers=java.util.logging.FileHandler
+
+.level = INFO
+
+java.util.logging.FileHandler.level=INFO
+java.util.logging.FileHandler.pattern=target/jcache-logging-%g.log
+java.util.logging.FileHandler.limit = 100000
+java.util.logging.FileHandler.count = 2
+java.util.logging.FileHandler.append=true
+java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
+java.util.logging.SimpleFormatter.format=[%1$tF %1$tT] %3$s [%4$-7s] %5$s %n

Reply via email to