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

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git

commit 4359328b92f19e5466a78d48547134a2c6045a31
Author: Martin Desruisseaux <martin.desruisse...@geomatys.com>
AuthorDate: Thu Jan 13 17:24:47 2022 +0100

    Revert the removal `DURATION_FOR_LOGGING` threshold for logging and add an 
explanation about the rational.
    Tune the log levels of JavaFX application.
---
 .../src/main/artifact/conf/logging.properties          | 12 +++++++-----
 .../factory/ConcurrentAuthorityFactory.java            | 18 ++++++++++++++++--
 2 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/application/sis-javafx/src/main/artifact/conf/logging.properties 
b/application/sis-javafx/src/main/artifact/conf/logging.properties
index 159cab5..cd968f6 100644
--- a/application/sis-javafx/src/main/artifact/conf/logging.properties
+++ b/application/sis-javafx/src/main/artifact/conf/logging.properties
@@ -28,13 +28,15 @@ handlers = java.util.logging.FileHandler, \
 
 
 # Filter the log records according their logging levels.
-# Filtering is applied:
+# Fine levels are used for allowing the application to
+# collect those records in the system monitor window:
 #
-#   - By package (CONFIG for SIS, INFO for everything else).
-#   - By handler (WARNING for console, ALL for log file).
+#   - By package (FINER for SIS, CONFIG for everything else).
+#   - By handler (WARNING for console, FINE for log file).
 
-.level = INFO
-org.apache.sis.level = CONFIG
+.level = CONFIG
+org.apache.sis.level = FINER
+java.util.logging.FileHandler.level = FINE
 java.util.logging.ConsoleHandler.level = WARNING
 
 
diff --git 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
index 41c0c76..3d19915 100644
--- 
a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
+++ 
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactory.java
@@ -106,6 +106,18 @@ public abstract class ConcurrentAuthorityFactory<DAO 
extends GeodeticAuthorityFa
         extends GeodeticAuthorityFactory implements AutoCloseable
 {
     /**
+     * Duration of data access operations that should be logged, in 
nanoseconds.
+     * Any operation that take longer than this amount of time to execute will 
have a message logged.
+     * The log level depends on the execution duration as specified in {@link 
PerformanceLevel}.
+     *
+     * <div class="note"><b>Rational:</b>
+     * we do not unconditionally log all creation messages because they are 
redundant with more detailed
+     * logs produced by {@link GeodeticObjectFactory}. Their only additional 
information is the creation
+     * duration, which is not very useful if too close to zero.</div>
+     */
+    private static final long DURATION_FOR_LOGGING = 10_000_000L;       // 10 
milliseconds.
+
+    /**
      * Sentinel value when {@link #authority} can not be determined because 
the data access object
      * can not be constructed.
      */
@@ -469,9 +481,11 @@ public abstract class ConcurrentAuthorityFactory<DAO 
extends GeodeticAuthorityFa
             /*
              * Log the event. Note: there is no need to check for 
`Semaphores.FINER_OBJECT_CREATION_LOGS`
              * because this method is not invoked, or is invoked with `type = 
null`, during execution of
-             * `IdentifiedObjectFinder` seach operations.
+             * `IdentifiedObjectFinder` search operations. The only new 
information in this log compared
+             * to `GeodeticObjectFactory` logs is the creation duration, not 
useful if too close to zero
+             * and always useful if too long.
              */
-            if (type != null) {
+            if (time >= DURATION_FOR_LOGGING && type != null) {
                 if (caller == null) {
                     caller = "create".concat(type.getSimpleName());
                 }

Reply via email to