You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2022/05/11 16:09:28 UTC
[sis] 02/03: Remove `LoggerFactory` and related classes and methods.
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 afb09262945f06fa5fe8011590877d3374fce64b
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Wed May 11 17:38:14 2022 +0200
Remove `LoggerFactory` and related classes and methods.
https://issues.apache.org/jira/browse/SIS-546
---
.../org/apache/sis/console/TransformCommand.java | 4 +-
.../apache/sis/gui/coverage/CoverageCanvas.java | 4 +-
.../org/apache/sis/gui/dataset/FeatureTable.java | 6 +-
.../org/apache/sis/gui/dataset/ResourceTree.java | 6 +-
.../java/org/apache/sis/gui/map/MapCanvas.java | 3 +-
.../org/apache/sis/gui/map/OperationFinder.java | 4 +-
.../org/apache/sis/gui/map/ValuesUnderCursor.java | 4 +-
.../org/apache/sis/gui/metadata/MetadataTree.java | 4 +-
.../apache/sis/gui/referencing/AuthorityCodes.java | 4 +-
.../gui/referencing/PositionableProjection.java | 4 +-
.../gui/referencing/RecentReferenceSystems.java | 4 +-
.../java/org/apache/sis/gui/referencing/Utils.java | 4 +-
.../apache/sis/internal/gui/BackgroundThreads.java | 4 +-
.../apache/sis/internal/gui/ImageConverter.java | 4 +-
.../java/org/apache/sis/internal/gui/Styles.java | 4 +-
.../java/org/apache/sis/openoffice/CalcAddins.java | 3 +-
.../coverage/grid/CoordinateOperationFinder.java | 4 +-
.../sis/coverage/grid/GridCoverageProcessor.java | 4 +-
.../apache/sis/coverage/grid/GridEvaluator.java | 4 +-
.../org/apache/sis/coverage/grid/GridExtent.java | 4 +-
.../org/apache/sis/coverage/grid/GridGeometry.java | 3 +-
.../java/org/apache/sis/feature/FeatureFormat.java | 4 +-
.../apache/sis/image/BandedSampleConverter.java | 4 +-
.../java/org/apache/sis/image/ErrorAction.java | 5 +-
.../main/java/org/apache/sis/image/MaskImage.java | 4 +-
.../java/org/apache/sis/image/ResampledImage.java | 4 +-
.../sis/internal/coverage/j2d/ImageUtilities.java | 4 +-
.../org/apache/sis/internal/feature/jts/JTS.java | 4 +-
.../java/org/apache/sis/internal/filter/Node.java | 2 +-
.../apache/sis/image/StatisticsCalculatorTest.java | 6 +-
.../internal/filter/sqlmm/RegistryTestCase.java | 5 +-
.../java/org/apache/sis/internal/jaxb/Context.java | 3 +-
.../apache/sis/internal/metadata/AxisNames.java | 4 +-
.../sis/internal/metadata/ServicesForUtility.java | 6 +-
.../sis/internal/metadata/sql/Initializer.java | 7 +-
.../sis/internal/metadata/sql/LocalDataSource.java | 4 +-
.../sis/internal/simple/CitationConstant.java | 4 +-
.../apache/sis/metadata/PropertyInformation.java | 5 +-
.../sis/metadata/StandardImplementation.java | 5 +-
.../apache/sis/metadata/sql/CachedStatement.java | 3 +-
.../main/java/org/apache/sis/util/iso/Types.java | 4 +-
.../main/java/org/apache/sis/xml/LegacyCodes.java | 4 +-
.../java/org/apache/sis/xml/MarshallerPool.java | 4 +-
.../src/main/java/org/apache/sis/xml/XLink.java | 4 +-
.../identification/DefaultBrowseGraphicTest.java | 6 +-
.../sis/internal/map/coverage/RenderingData.java | 4 +-
.../gazetteer/MilitaryGridReferenceSystem.java | 4 +-
.../org/apache/sis/geometry/CoordinateFormat.java | 4 +-
.../java/org/apache/sis/geometry/Envelopes.java | 5 +-
.../apache/sis/geometry/WraparoundAdjustment.java | 4 +-
.../sis/internal/referencing/DatabaseListener.java | 4 +-
.../internal/referencing/ServicesForMetadata.java | 4 +-
.../referencing/provider/AbstractProvider.java | 4 +-
.../referencing/provider/GeocentricAffine.java | 4 +-
.../java/org/apache/sis/io/wkt/AbstractParser.java | 3 +-
.../sis/parameter/DefaultParameterValue.java | 3 +-
.../main/java/org/apache/sis/referencing/CRS.java | 6 +-
.../java/org/apache/sis/referencing/CommonCRS.java | 3 +-
.../apache/sis/referencing/IdentifiedObjects.java | 3 +-
.../sis/referencing/crs/DefaultProjectedCRS.java | 3 +-
.../org/apache/sis/referencing/cs/AbstractCS.java | 3 +-
.../sis/referencing/cs/CoordinateSystems.java | 4 +-
.../sis/referencing/cs/DirectionAlongMeridian.java | 4 +-
.../referencing/datum/DefaultGeodeticDatum.java | 5 +-
.../factory/CommonAuthorityFactory.java | 4 +-
.../factory/ConcurrentAuthorityFactory.java | 4 +-
.../referencing/factory/GeodeticObjectFactory.java | 3 +-
.../factory/sql/CloseableReference.java | 4 +-
.../referencing/factory/sql/EPSGCodeFinder.java | 3 +-
.../referencing/factory/sql/EPSGDataAccess.java | 6 +-
.../operation/AbstractCoordinateOperation.java | 3 +-
.../operation/CoordinateOperationRegistry.java | 4 +-
.../operation/projection/NormalizedProjection.java | 3 +-
.../operation/transform/ConcatenatedTransform.java | 4 +-
.../operation/transform/ContextualParameters.java | 4 +-
.../transform/DefaultMathTransformFactory.java | 6 +-
.../operation/transform/WraparoundTransform.java | 4 +-
.../factory/ConcurrentAuthorityFactoryTest.java | 4 +-
.../sis/referencing/factory/TestFactorySource.java | 6 +-
.../apache/sis/internal/system/DataDirectory.java | 4 +-
.../sis/internal/system/DefaultFactories.java | 6 +-
.../sis/internal/system/DelayedExecutor.java | 4 +-
.../org/apache/sis/internal/system/Loggers.java | 4 +-
.../internal/system/ReferenceQueueConsumer.java | 4 +-
.../org/apache/sis/internal/system/Shutdown.java | 4 +-
.../org/apache/sis/internal/system/Threads.java | 4 +-
.../apache/sis/internal/util/DefinitionURI.java | 3 +-
.../src/main/java/org/apache/sis/math/Vector.java | 3 +-
.../java/org/apache/sis/measure/AbstractUnit.java | 4 +-
.../java/org/apache/sis/measure/UnitFormat.java | 4 +-
.../java/org/apache/sis/measure/UnitServices.java | 4 +-
.../src/main/java/org/apache/sis/setup/About.java | 22 +-
.../main/java/org/apache/sis/setup/OptionKey.java | 8 +-
.../src/main/java/org/apache/sis/util/Locales.java | 3 +-
.../org/apache/sis/util/collection/WeakEntry.java | 3 +-
.../org/apache/sis/util/logging/DualLogger.java | 107 ---
.../apache/sis/util/logging/DualLoggerFactory.java | 89 ---
.../org/apache/sis/util/logging/LoggerAdapter.java | 806 ---------------------
.../org/apache/sis/util/logging/LoggerFactory.java | 153 ----
.../java/org/apache/sis/util/logging/Logging.java | 123 +---
.../apache/sis/util/logging/MonolineFormatter.java | 6 +-
.../org/apache/sis/util/logging/package-info.java | 31 +-
.../sis/util/resources/IndexedResourceBundle.java | 4 +-
.../java/org/apache/sis/test/LoggingWatcher.java | 2 +-
.../apache/sis/test/suite/UtilityTestSuite.java | 1 -
.../org/apache/sis/util/logging/DummyLogger.java | 114 ---
.../apache/sis/util/logging/LoggerAdapterTest.java | 74 --
.../org/apache/sis/internal/netcdf/Decoder.java | 3 +-
.../apache/sis/internal/shapefile/AutoChecker.java | 4 +-
.../sis/storage/shapefile/InputFeatureStream.java | 3 +-
.../jdbc/AbstractTestBaseForInternalJDBC.java | 3 +-
.../sis/storage/shapefile/ShapeFileTest.java | 4 +-
.../internal/storage/DocumentedStoreProvider.java | 4 +-
.../sis/internal/storage/StoreUtilities.java | 3 +-
.../apache/sis/storage/event/StoreListeners.java | 2 +-
115 files changed, 309 insertions(+), 1637 deletions(-)
diff --git a/application/sis-console/src/main/java/org/apache/sis/console/TransformCommand.java b/application/sis-console/src/main/java/org/apache/sis/console/TransformCommand.java
index f0c7d9d2a8..bd45c0d9ce 100644
--- a/application/sis-console/src/main/java/org/apache/sis/console/TransformCommand.java
+++ b/application/sis-console/src/main/java/org/apache/sis/console/TransformCommand.java
@@ -74,6 +74,8 @@ import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.CharSequences;
+import static java.util.logging.Logger.getLogger;
+
/**
* The "transform" subcommand.
@@ -650,6 +652,6 @@ final class TransformCommand extends FormattedOutputCommand {
* considered as an indication that the point is outside the domain of validity.
*/
private static void warning(final Exception e) {
- Logging.recoverableException(Logging.getLogger(Modules.CONSOLE), TransformCommand.class, "run", e);
+ Logging.recoverableException(getLogger(Modules.CONSOLE), TransformCommand.class, "run", e);
}
}
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
index 7ff5efed41..f76bd19e9a 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/coverage/CoverageCanvas.java
@@ -81,6 +81,8 @@ import org.apache.sis.io.TableAppender;
import org.apache.sis.measure.Units;
import org.apache.sis.util.Debug;
+import static java.util.logging.Logger.getLogger;
+
/**
* A canvas for {@link RenderedImage} provided by a {@link GridCoverage} or a {@link GridCoverageResource}.
@@ -1048,7 +1050,7 @@ public class CoverageCanvas extends MapCanvasAWT {
* Invoked when an exception occurred while computing a transform but the painting process can continue.
*/
private static void unexpectedException(final Exception e) {
- Logging.unexpectedException(Logging.getLogger(Modules.APPLICATION), CoverageCanvas.class, "render", e);
+ Logging.unexpectedException(getLogger(Modules.APPLICATION), CoverageCanvas.class, "render", e);
}
/**
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/FeatureTable.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/FeatureTable.java
index 2ffa5c4e02..9e023999ea 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/FeatureTable.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/FeatureTable.java
@@ -51,6 +51,8 @@ import org.apache.sis.internal.feature.AttributeConvention;
import org.apache.sis.internal.gui.IdentityValueFactory;
import org.apache.sis.internal.gui.ExceptionReporter;
+import static java.util.logging.Logger.getLogger;
+
/**
* A view of {@link FeatureSet} data organized as a table. The features are specified by a call
@@ -482,13 +484,13 @@ public class FeatureTable extends TableView<Feature> {
* public API (if possible) invoking the method where the exception is caught.
*/
static void unexpectedException(final String method, final Throwable exception) {
- Logging.unexpectedException(Logging.getLogger(Modules.APPLICATION), FeatureTable.class, method, exception);
+ Logging.unexpectedException(getLogger(Modules.APPLICATION), FeatureTable.class, method, exception);
}
/**
* Reports an exception that we choose to ignore.
*/
static void recoverableException(final String method, final Exception exception) {
- Logging.recoverableException(Logging.getLogger(Modules.APPLICATION), FeatureTable.class, method, exception);
+ Logging.recoverableException(getLogger(Modules.APPLICATION), FeatureTable.class, method, exception);
}
}
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceTree.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceTree.java
index 1e77a5570e..3b0ef263a1 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceTree.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/dataset/ResourceTree.java
@@ -74,6 +74,8 @@ import org.apache.sis.internal.util.Strings;
import org.apache.sis.storage.DataStoreProvider;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* A view of data {@link Resource}s organized as a tree.
@@ -584,14 +586,14 @@ public class ResourceTree extends TreeView<Resource> {
* Reports an ignorable exception in the given method.
*/
private static void recoverableException(final String method, final Exception e) {
- Logging.recoverableException(Logging.getLogger(Modules.APPLICATION), ResourceTree.class, method, e);
+ Logging.recoverableException(getLogger(Modules.APPLICATION), ResourceTree.class, method, e);
}
/**
* Reports an unexpected but non-fatal exception in the given method.
*/
static void unexpectedException(final String method, final Exception e) {
- Logging.unexpectedException(Logging.getLogger(Modules.APPLICATION), ResourceTree.class, method, e);
+ Logging.unexpectedException(getLogger(Modules.APPLICATION), ResourceTree.class, method, e);
}
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvas.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvas.java
index be9019dfe8..97b8fa2e7c 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvas.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/MapCanvas.java
@@ -84,6 +84,7 @@ import org.apache.sis.portrayal.PlanarCanvas;
import org.apache.sis.portrayal.RenderException;
import org.apache.sis.referencing.IdentifiedObjects;
+import static java.util.logging.Logger.getLogger;
import static org.apache.sis.internal.util.StandardDateFormat.NANOS_PER_MILLISECOND;
@@ -1284,7 +1285,7 @@ public abstract class MapCanvas extends PlanarCanvas {
* Invoked when an unexpected exception occurred but it is okay to continue despite it.
*/
private static void unexpectedException(final String method, final Exception e) {
- Logging.unexpectedException(Logging.getLogger(Modules.APPLICATION), MapCanvas.class, method, e);
+ Logging.unexpectedException(getLogger(Modules.APPLICATION), MapCanvas.class, method, e);
}
/**
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/OperationFinder.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/OperationFinder.java
index b9b2ff175d..0211c55141 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/OperationFinder.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/OperationFinder.java
@@ -35,6 +35,8 @@ import org.apache.sis.referencing.operation.transform.MathTransforms;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.Modules;
+import static java.util.logging.Logger.getLogger;
+
/**
* Finds a coordinate operation between two CRS in the context of a {@link MapCanvas}.
@@ -129,7 +131,7 @@ abstract class OperationFinder extends Task<MathTransform> {
bbox.setBounds(areaOfInterest);
} catch (TransformException e) {
bbox = null;
- Logging.recoverableException(Logging.getLogger(Modules.APPLICATION), getCallerClass(), getCallerMethod(), e);
+ Logging.recoverableException(getLogger(Modules.APPLICATION), getCallerClass(), getCallerMethod(), e);
}
MathTransform before = null;
MathTransform after = null;
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/ValuesUnderCursor.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/ValuesUnderCursor.java
index 3518f4c990..ab13e5af93 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/map/ValuesUnderCursor.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/map/ValuesUnderCursor.java
@@ -55,6 +55,8 @@ import org.apache.sis.util.Localized;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Vocabulary;
+import static java.util.logging.Logger.getLogger;
+
/**
* Provider of textual content to show in a {@link StatusBar} for values under cursor position.
@@ -613,7 +615,7 @@ public abstract class ValuesUnderCursor {
final String message = e.getMessage();
if (!message.equals(lastErrorMessage)) {
lastErrorMessage = message;
- Logging.recoverableException(Logging.getLogger(Modules.APPLICATION), ValuesUnderCursor.class, method, e);
+ Logging.recoverableException(getLogger(Modules.APPLICATION), ValuesUnderCursor.class, method, e);
}
}
}
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/MetadataTree.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/MetadataTree.java
index c8c2558b5e..a98544aa22 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/MetadataTree.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/metadata/MetadataTree.java
@@ -56,6 +56,8 @@ import org.apache.sis.util.collection.TableColumn;
import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* A view of metadata represented by a {@link TreeTable}. This base class can represent
@@ -382,7 +384,7 @@ check: if (data != null) {
flush();
value = buffer.toString();
} catch (IOException e) { // Should never happen because we append in a StringBuilder.
- Logging.unexpectedException(Logging.getLogger(Modules.APPLICATION), Formatter.class, "call", e);
+ Logging.unexpectedException(getLogger(Modules.APPLICATION), Formatter.class, "call", e);
// Leave `value` as-is. It will be formatted using `Object.toString()`.
}
return new ReadOnlyObjectWrapper<>(value);
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/AuthorityCodes.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/AuthorityCodes.java
index f8b3e61d69..d8fdc3e3cd 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/AuthorityCodes.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/AuthorityCodes.java
@@ -47,6 +47,8 @@ import org.apache.sis.internal.gui.BackgroundThreads;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.util.Strings;
+import static java.util.logging.Logger.getLogger;
+
/**
* A list of authority codes (usually for CRS) which fetch code values in a background thread
@@ -519,7 +521,7 @@ final class AuthorityCodes extends ObservableListBase<Code>
private void errorOccurred(final Throwable e) {
if (!hasError) {
hasError = true; // Not a big problem if we have race condition; error will just be logged twice.
- Logging.unexpectedException(Logging.getLogger(Modules.APPLICATION), AuthorityCodes.class, "get", e);
+ Logging.unexpectedException(getLogger(Modules.APPLICATION), AuthorityCodes.class, "get", e);
}
}
}
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/PositionableProjection.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/PositionableProjection.java
index ed66f71e61..ce1d591f13 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/PositionableProjection.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/PositionableProjection.java
@@ -40,6 +40,8 @@ import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.Utilities;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* Provider of map projections centered on a point of interest.
@@ -112,7 +114,7 @@ public abstract class PositionableProjection extends CodeList<PositionableProjec
try {
cd = CommonCRS.forDatum(baseCRS);
} catch (IllegalArgumentException e) {
- Logging.recoverableException(Logging.getLogger(Modules.APPLICATION),
+ Logging.recoverableException(getLogger(Modules.APPLICATION),
PositionableProjection.class, "createProjectedCRS", e);
cd = CommonCRS.WGS84;
}
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/RecentReferenceSystems.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/RecentReferenceSystems.java
index d0eebf68ba..48c1e56326 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/RecentReferenceSystems.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/RecentReferenceSystems.java
@@ -56,6 +56,8 @@ import org.apache.sis.internal.gui.RecentChoices;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.util.Strings;
+import static java.util.logging.Logger.getLogger;
+
/**
* A short list (~10 items) of most recently used {@link ReferenceSystem}s.
@@ -894,6 +896,6 @@ next: for (int i=0; i<count; i++) {
*/
protected void errorOccurred(final FactoryException e) {
OptionalDataDownloader.reportIfInstalling(e);
- Logging.recoverableException(Logging.getLogger(Modules.APPLICATION), RecentReferenceSystems.class, "updateItems", e);
+ Logging.recoverableException(getLogger(Modules.APPLICATION), RecentReferenceSystems.class, "updateItems", e);
}
}
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/Utils.java b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/Utils.java
index bb7f6c749b..d5301cfeee 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/Utils.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/gui/referencing/Utils.java
@@ -33,6 +33,8 @@ import org.apache.sis.util.logging.Logging;
import org.apache.sis.referencing.CommonCRS;
import org.apache.sis.referencing.CRS;
+import static java.util.logging.Logger.getLogger;
+
/**
* Utility methods shared by classes in this package only.
@@ -73,7 +75,7 @@ final class Utils {
bbox.setBounds(areaOfInterest);
return new ImmutableEnvelope(bbox);
} catch (TransformException e) {
- Logging.recoverableException(Logging.getLogger(Modules.APPLICATION), caller, method, e);
+ Logging.recoverableException(getLogger(Modules.APPLICATION), caller, method, e);
}
return null;
}
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/BackgroundThreads.java b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/BackgroundThreads.java
index b65a181ee9..c5351dbb46 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/BackgroundThreads.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/BackgroundThreads.java
@@ -32,6 +32,8 @@ import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.system.Threads;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* Provides the thread pool for JavaFX application. This thread pool is different than the pool used by
@@ -177,6 +179,6 @@ public final class BackgroundThreads extends AtomicInteger implements ThreadFact
* @param e the exception that interrupted the waiting process.
*/
private static void interrupted(final String method, final InterruptedException e) {
- Logging.unexpectedException(Logging.getLogger(Modules.APPLICATION), BackgroundThreads.class, method, e);
+ Logging.unexpectedException(getLogger(Modules.APPLICATION), BackgroundThreads.class, method, e);
}
}
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ImageConverter.java b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ImageConverter.java
index 318c537571..77bed28dd8 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ImageConverter.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/ImageConverter.java
@@ -44,6 +44,8 @@ import org.apache.sis.util.logging.Logging;
import org.apache.sis.measure.NumberRange;
import org.apache.sis.math.Statistics;
+import static java.util.logging.Logger.getLogger;
+
/**
* Converts a Java2D image to a JavaFX image, then writes the result in a given {@link ImageView}.
@@ -211,7 +213,7 @@ final class ImageConverter extends Task<Statistics[]> {
return processor.visualize((RenderedImage) mask, MASK_TRANSPARENCY);
} catch (IllegalArgumentException e) {
// Ignore, we will not apply any mask. Declare PropertyView.setImage(…) as the public method.
- Logging.recoverableException(Logging.getLogger(Loggers.APPLICATION), PropertyView.class, "setImage", e);
+ Logging.recoverableException(getLogger(Loggers.APPLICATION), PropertyView.class, "setImage", e);
}
return null;
}
diff --git a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Styles.java b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Styles.java
index fb244d0e72..8e1422bb06 100644
--- a/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Styles.java
+++ b/application/sis-javafx/src/main/java/org/apache/sis/internal/gui/Styles.java
@@ -33,6 +33,8 @@ import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.util.Static;
+import static java.util.logging.Logger.getLogger;
+
/**
* A central place where to store some appearance choices such as colors used by SIS application.
@@ -158,7 +160,7 @@ public final class Styles extends Static {
error = e;
}
if (error != null) {
- Logging.unexpectedException(Logging.getLogger(Modules.APPLICATION), caller, method, error);
+ Logging.unexpectedException(getLogger(Modules.APPLICATION), caller, method, error);
}
return image;
}
diff --git a/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/CalcAddins.java b/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/CalcAddins.java
index b05746e2f6..68abbf23d9 100644
--- a/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/CalcAddins.java
+++ b/application/sis-openoffice/src/main/java/org/apache/sis/openoffice/CalcAddins.java
@@ -29,7 +29,6 @@ import com.sun.star.lib.uno.helper.WeakBase;
import org.apache.sis.util.Classes;
import org.apache.sis.util.Exceptions;
-import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Vocabulary;
@@ -207,7 +206,7 @@ public abstract class CalcAddins extends WeakBase implements XServiceName, XServ
*/
protected final synchronized Logger getLogger() {
if (logger == null) {
- logger = Logging.getLogger(Registration.LOGGER);
+ logger = Logger.getLogger(Registration.LOGGER);
}
return logger;
}
diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/CoordinateOperationFinder.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/CoordinateOperationFinder.java
index df88dbbb02..11f1c65f34 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/CoordinateOperationFinder.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/CoordinateOperationFinder.java
@@ -46,6 +46,8 @@ import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.util.Numerics;
+import static java.util.logging.Logger.getLogger;
+
/**
* Finds a transform from grid cells in a source coverage to geospatial positions in the CRS of a target coverage.
@@ -744,6 +746,6 @@ apply: if (forwardChangeOfCRS == null) {
* @param e the ignorable exception.
*/
private static void recoverableException(final String caller, final Exception e) {
- Logging.recoverableException(Logging.getLogger(Modules.RASTER), CoordinateOperationFinder.class, caller, e);
+ Logging.recoverableException(getLogger(Modules.RASTER), CoordinateOperationFinder.class, caller, e);
}
}
diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverageProcessor.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverageProcessor.java
index fd4944689c..01b2ecab9d 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverageProcessor.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridCoverageProcessor.java
@@ -31,6 +31,8 @@ import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.util.FinalFieldSetter;
import org.apache.sis.coverage.RegionOfInterest;
+import static java.util.logging.Logger.getLogger;
+
/**
* A predefined set of operations on grid coverages as convenience methods.
@@ -272,7 +274,7 @@ public class GridCoverageProcessor implements Cloneable {
* @param ex the ignorable exception.
*/
static void recoverableException(final String caller, final Exception ex) {
- Logging.recoverableException(Logging.getLogger(Modules.RASTER), GridCoverageProcessor.class, caller, ex);
+ Logging.recoverableException(getLogger(Modules.RASTER), GridCoverageProcessor.class, caller, ex);
}
/**
diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridEvaluator.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridEvaluator.java
index f246d44acb..4fd6641959 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridEvaluator.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridEvaluator.java
@@ -38,6 +38,8 @@ import org.apache.sis.internal.system.Modules;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* Computes or interpolates values of sample dimensions at given positions.
@@ -466,6 +468,6 @@ public class GridEvaluator implements GridCoverage.Evaluator {
* @param exception the exception that occurred.
*/
private static void recoverableException(final String caller, final TransformException exception) {
- Logging.recoverableException(Logging.getLogger(Modules.RASTER), GridEvaluator.class, caller, exception);
+ Logging.recoverableException(getLogger(Modules.RASTER), GridEvaluator.class, caller, exception);
}
}
diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
index 935149a81c..9064f91fdd 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridExtent.java
@@ -63,6 +63,8 @@ import org.apache.sis.util.iso.Types;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.Modules;
+import static java.util.logging.Logger.getLogger;
+
// Branch-dependent imports
import org.opengis.coverage.grid.GridEnvelope;
import org.opengis.coverage.grid.GridCoordinates;
@@ -1047,7 +1049,7 @@ public class GridExtent implements GridEnvelope, LenientComparable, Serializable
}
} catch (FactoryException e) {
// "toEnvelope" is the closest public method that may invoke this method.
- Logging.recoverableException(Logging.getLogger(Modules.RASTER), GridExtent.class, "toEnvelope", e);
+ Logging.recoverableException(getLogger(Modules.RASTER), GridExtent.class, "toEnvelope", e);
}
return envelope;
}
diff --git a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java
index 7e5ea0705c..7a9d5c481d 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java
@@ -80,6 +80,7 @@ import org.apache.sis.io.TableAppender;
import org.apache.sis.xml.NilObject;
import org.apache.sis.xml.NilReason;
+import static java.util.logging.Logger.getLogger;
import static org.apache.sis.referencing.CRS.findOperation;
@@ -578,7 +579,7 @@ public class GridGeometry implements LenientComparable, Serializable {
* @param exception the exception that occurred.
*/
static void recoverableException(final String caller, final TransformException exception) {
- Logging.recoverableException(Logging.getLogger(Modules.RASTER), GridGeometry.class, caller, exception);
+ Logging.recoverableException(getLogger(Modules.RASTER), GridGeometry.class, caller, exception);
}
/**
diff --git a/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java b/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
index e839cb0540..150a87b06c 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/feature/FeatureFormat.java
@@ -51,6 +51,8 @@ import org.apache.sis.internal.system.Modules;
import org.apache.sis.referencing.IdentifiedObjects;
import org.apache.sis.math.MathFunctions;
+import static java.util.logging.Logger.getLogger;
+
// Branch-dependent imports
import org.opengis.feature.IdentifiedType;
import org.opengis.feature.Property;
@@ -586,7 +588,7 @@ public class FeatureFormat extends TabularFormat<Object> {
final int bits = Float.floatToRawIntBits(f);
if (bits != illegalNaN) {
illegalNaN = bits;
- Logging.recoverableException(Logging.getLogger(Modules.FEATURE), FeatureFormat.class, "format", e);
+ Logging.recoverableException(getLogger(Modules.FEATURE), FeatureFormat.class, "format", e);
}
}
}
diff --git a/core/sis-feature/src/main/java/org/apache/sis/image/BandedSampleConverter.java b/core/sis-feature/src/main/java/org/apache/sis/image/BandedSampleConverter.java
index 04fa3c81e6..24ad4c6c3c 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/image/BandedSampleConverter.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/image/BandedSampleConverter.java
@@ -41,6 +41,8 @@ import org.apache.sis.util.logging.Logging;
import org.apache.sis.math.DecimalFunctions;
import org.apache.sis.measure.NumberRange;
+import static java.util.logging.Logger.getLogger;
+
/**
* An image where each sample value is computed independently of other sample values and independently
@@ -214,7 +216,7 @@ class BandedSampleConverter extends ComputedImage {
}
return new Writable((WritableRenderedImage) source, sampleModel, colorModel, sourceRanges, converters, inverses);
} catch (NoninvertibleTransformException e) {
- Logging.recoverableException(Logging.getLogger(Modules.RASTER), ImageProcessor.class, "convert", e);
+ Logging.recoverableException(getLogger(Modules.RASTER), ImageProcessor.class, "convert", e);
}
return new BandedSampleConverter(source, sampleModel, colorModel, sourceRanges, converters);
}
diff --git a/core/sis-feature/src/main/java/org/apache/sis/image/ErrorAction.java b/core/sis-feature/src/main/java/org/apache/sis/image/ErrorAction.java
index 22c5a99d5a..014030c62a 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/image/ErrorAction.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/image/ErrorAction.java
@@ -19,9 +19,10 @@ package org.apache.sis.image;
import java.util.logging.LogRecord;
import java.util.logging.SimpleFormatter;
import java.awt.image.ImagingOpException;
-import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.Modules;
+import static java.util.logging.Logger.getLogger;
+
/**
* Some common ways to handle exceptions occurring during tile calculation.
@@ -65,7 +66,7 @@ enum ErrorAction implements ErrorHandler {
logger = Modules.RASTER;
record.setLoggerName(logger);
}
- Logging.getLogger(logger).log(record);
+ getLogger(logger).log(record);
} else {
final Throwable ex = record.getThrown();
if (ex instanceof Error) {
diff --git a/core/sis-feature/src/main/java/org/apache/sis/image/MaskImage.java b/core/sis-feature/src/main/java/org/apache/sis/image/MaskImage.java
index 16d26559ab..c2284d4c60 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/image/MaskImage.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/image/MaskImage.java
@@ -26,6 +26,8 @@ import org.apache.sis.internal.coverage.j2d.ImageUtilities;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* Mask of missing values.
@@ -57,7 +59,7 @@ final class MaskImage extends SourceAlignedImage {
converter = ((Visualization.InterpConvert) image.interpolation).converter.inverse();
} catch (NoninvertibleTransformException e) {
// ResampledImage.getProperty("org.apache.sis.Mask") is the public caller of this constructor.
- Logging.unexpectedException(Logging.getLogger(Modules.RASTER), ResampledImage.class, "getProperty", e);
+ Logging.unexpectedException(getLogger(Modules.RASTER), ResampledImage.class, "getProperty", e);
}
}
diff --git a/core/sis-feature/src/main/java/org/apache/sis/image/ResampledImage.java b/core/sis-feature/src/main/java/org/apache/sis/image/ResampledImage.java
index ec3107e284..344a886265 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/image/ResampledImage.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/image/ResampledImage.java
@@ -50,6 +50,8 @@ import org.apache.sis.geometry.Shapes2D;
import org.apache.sis.measure.Quantities;
import org.apache.sis.measure.Units;
+import static java.util.logging.Logger.getLogger;
+
/**
* An image which is the result of resampling the pixel values of another image.
@@ -461,7 +463,7 @@ public class ResampledImage extends ComputedImage {
* @param error the ignore which can be ignored.
*/
private static void recoverableException(final String method, final Exception error) {
- Logging.recoverableException(Logging.getLogger(Modules.RASTER), ResampledImage.class, method, error);
+ Logging.recoverableException(getLogger(Modules.RASTER), ResampledImage.class, method, error);
}
/**
diff --git a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/ImageUtilities.java b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/ImageUtilities.java
index e95631f54c..b5fa25d2e1 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/ImageUtilities.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/internal/coverage/j2d/ImageUtilities.java
@@ -35,7 +35,6 @@ import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.util.Numerics;
import org.apache.sis.util.Numbers;
import org.apache.sis.util.Static;
-import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Vocabulary;
import static java.lang.Math.abs;
@@ -43,6 +42,7 @@ import static java.lang.Math.rint;
import static java.lang.Math.floorDiv;
import static java.lang.Math.addExact;
import static java.lang.Math.toIntExact;
+import static java.util.logging.Logger.getLogger;
import static org.apache.sis.internal.jdk9.JDK9.multiplyFull;
import static org.apache.sis.internal.util.Numerics.COMPARISON_THRESHOLD;
@@ -370,7 +370,7 @@ public final class ImageUtilities extends Static {
}
if (!Arrays.equals(m1, m2)) {
// If this logging happen, we should revisit this method and improve it.
- Logging.getLogger(Modules.RASTER).warning("Band names may be in wrong order.");
+ getLogger(Modules.RASTER).warning("Band names may be in wrong order.");
}
}
}
diff --git a/core/sis-feature/src/main/java/org/apache/sis/internal/feature/jts/JTS.java b/core/sis-feature/src/main/java/org/apache/sis/internal/feature/jts/JTS.java
index c3b1b01bdb..9bcc183b88 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/internal/feature/jts/JTS.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/internal/feature/jts/JTS.java
@@ -39,6 +39,8 @@ import org.locationtech.jts.geom.Envelope;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
+import static java.util.logging.Logger.getLogger;
+
/**
* Utilities for Java Topology Suite (JTS) objects.
@@ -214,7 +216,7 @@ public final class JTS extends Static {
bbox.setBounds(env);
} catch (TransformException ex) {
bbox = null;
- Logging.ignorableException(Logging.getLogger(Loggers.GEOMETRY), JTS.class, "transform", ex);
+ Logging.ignorableException(getLogger(Loggers.GEOMETRY), JTS.class, "transform", ex);
}
return CRS.findOperation(sourceCRS, targetCRS, bbox);
}
diff --git a/core/sis-feature/src/main/java/org/apache/sis/internal/filter/Node.java b/core/sis-feature/src/main/java/org/apache/sis/internal/filter/Node.java
index 1560d22d52..dfcf7164b5 100644
--- a/core/sis-feature/src/main/java/org/apache/sis/internal/filter/Node.java
+++ b/core/sis-feature/src/main/java/org/apache/sis/internal/filter/Node.java
@@ -281,7 +281,7 @@ public abstract class Node implements Serializable {
* @see <a href="https://issues.apache.org/jira/browse/SIS-460">SIS-460</a>
*/
protected final void warning(final Exception e, final boolean recoverable) {
- final Logger logger = Logging.getLogger(Loggers.FILTER);
+ final Logger logger = Logger.getLogger(Loggers.FILTER);
final String method = (this instanceof Predicate) ? "test" : "apply";
if (recoverable) {
Logging.recoverableException(logger, getClass(), method, e);
diff --git a/core/sis-feature/src/test/java/org/apache/sis/image/StatisticsCalculatorTest.java b/core/sis-feature/src/test/java/org/apache/sis/image/StatisticsCalculatorTest.java
index 140f580a4c..bdcc504fb7 100644
--- a/core/sis-feature/src/test/java/org/apache/sis/image/StatisticsCalculatorTest.java
+++ b/core/sis-feature/src/test/java/org/apache/sis/image/StatisticsCalculatorTest.java
@@ -16,9 +16,9 @@
*/
package org.apache.sis.image;
+import java.util.Random;
import java.awt.Shape;
import java.awt.geom.Ellipse2D;
-import java.util.Random;
import java.awt.image.DataBuffer;
import java.awt.image.RenderedImage;
import java.awt.image.ImagingOpException;
@@ -27,11 +27,11 @@ import org.apache.sis.internal.system.Modules;
import org.apache.sis.math.Statistics;
import org.apache.sis.test.DependsOnMethod;
import org.apache.sis.test.LoggingWatcher;
-import org.apache.sis.util.logging.Logging;
import org.apache.sis.test.TestCase;
import org.junit.Rule;
import org.junit.Test;
+import static java.util.logging.Logger.getLogger;
import static org.junit.Assert.*;
@@ -56,7 +56,7 @@ public final strictfp class StatisticsCalculatorTest extends TestCase {
* Intercepts log records for verifying them.
*/
@Rule
- public final LoggingWatcher loggings = new LoggingWatcher(Logging.getLogger(Modules.RASTER));
+ public final LoggingWatcher loggings = new LoggingWatcher(getLogger(Modules.RASTER));
/**
* The area of interest, or {@code null} if none.
diff --git a/core/sis-feature/src/test/java/org/apache/sis/internal/filter/sqlmm/RegistryTestCase.java b/core/sis-feature/src/test/java/org/apache/sis/internal/filter/sqlmm/RegistryTestCase.java
index 9974d1a6bc..a228df9103 100644
--- a/core/sis-feature/src/test/java/org/apache/sis/internal/filter/sqlmm/RegistryTestCase.java
+++ b/core/sis-feature/src/test/java/org/apache/sis/internal/filter/sqlmm/RegistryTestCase.java
@@ -30,9 +30,10 @@ import org.apache.sis.geometry.WraparoundMethod;
import org.apache.sis.internal.feature.Geometries;
import org.apache.sis.internal.feature.GeometryWrapper;
import org.apache.sis.internal.system.Loggers;
-import org.apache.sis.util.logging.Logging;
import org.apache.sis.math.Vector;
+import static java.util.logging.Logger.getLogger;
+
// Test dependencies
import org.apache.sis.referencing.crs.HardCodedCRS;
import org.apache.sis.test.LoggingWatcher;
@@ -112,7 +113,7 @@ public abstract strictfp class RegistryTestCase<G> extends TestCase {
* @see #assertNoUnexpectedLog()
*/
@Rule
- public final LoggingWatcher loggings = new LoggingWatcher(Logging.getLogger(Loggers.FILTER));
+ public final LoggingWatcher loggings = new LoggingWatcher(getLogger(Loggers.FILTER));
/**
* Creates a new test case.
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/Context.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/Context.java
index e99fe77da3..801ccad349 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/Context.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/Context.java
@@ -29,7 +29,6 @@ import java.util.logging.LogRecord;
import java.util.logging.Filter;
import org.apache.sis.util.Version;
import org.apache.sis.util.Exceptions;
-import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.resources.Messages;
import org.apache.sis.util.resources.IndexedResourceBundle;
@@ -120,7 +119,7 @@ public final class Context extends MarshalContext {
/**
* The logger to use for warnings that are specific to XML.
*/
- public static final Logger LOGGER = Logging.getLogger(Loggers.XML);
+ public static final Logger LOGGER = Logger.getLogger(Loggers.XML);
/**
* Various boolean attributes determines by the above static constants.
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisNames.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisNames.java
index 7cde0f0905..116bfefd6f 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisNames.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/AxisNames.java
@@ -22,6 +22,8 @@ import java.lang.reflect.Field;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.Modules;
+import static java.util.logging.Logger.getLogger;
+
/**
* Constants for axis names specified by ISO 19111 and ISO 19162.
@@ -177,7 +179,7 @@ public final class AxisNames {
* We will take the values that we have been able to map so far. The other values will
* just not have their case fixed.
*/
- Logging.unexpectedException(Logging.getLogger(Modules.REFERENCING), AxisNames.class, "<cinit>", e);
+ Logging.unexpectedException(getLogger(Modules.REFERENCING), AxisNames.class, "<cinit>", e);
}
VALUES = values;
}
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java
index 2cf4b6cef1..c3638cfe54 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/ServicesForUtility.java
@@ -19,9 +19,9 @@ package org.apache.sis.internal.metadata;
import java.text.Format;
import java.util.Locale;
import java.util.TimeZone;
+import java.util.function.Supplier;
import javax.sql.DataSource;
import java.sql.SQLException;
-import java.util.function.Supplier;
import org.opengis.util.ControlledVocabulary;
import org.opengis.metadata.citation.Citation;
import org.apache.sis.internal.util.MetadataServices;
@@ -34,6 +34,7 @@ import org.apache.sis.util.Exceptions;
import org.apache.sis.util.Classes;
import org.apache.sis.util.resources.Errors;
+import static java.util.logging.Logger.getLogger;
/**
@@ -109,8 +110,7 @@ public final class ServicesForUtility extends MetadataServices {
server = type.getMethod("getServerName", (Class[]) null).invoke(ds, (Object[]) null);
}
} catch (NoSuchMethodException e) {
- Logging.recoverableException(Logging.getLogger(Loggers.SYSTEM),
- MetadataServices.class, "getInformation", e);
+ Logging.recoverableException(getLogger(Loggers.SYSTEM), MetadataServices.class, "getInformation", e);
} catch (Exception e) {
// Leave the message unchanged if it contains at least 2 words.
String message = Exceptions.getLocalizedMessage(e, locale);
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/Initializer.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/Initializer.java
index 6dc76a3f0b..6c5b6297b7 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/Initializer.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/Initializer.java
@@ -45,6 +45,7 @@ import org.apache.sis.util.resources.Messages;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.Configuration;
+import static java.util.logging.Logger.getLogger;
import static org.apache.sis.internal.util.MetadataServices.EMBEDDED;
@@ -192,7 +193,7 @@ public abstract class Initializer {
* automatically by other kinds of JNDI events. Even if the listener is not unregistered,
* it will not hurt too badly: the DataSource would only be fetched more often than necessary.
*/
- Logging.recoverableException(Logging.getLogger(Loggers.SYSTEM), Listener.class, "objectChanged", e);
+ Logging.recoverableException(getLogger(Loggers.SYSTEM), Listener.class, "objectChanged", e);
}
for (Initializer init : DefaultFactories.createServiceLoader(Initializer.class)) {
init.dataSourceChanged();
@@ -206,7 +207,7 @@ public abstract class Initializer {
*/
@Override
public void namingExceptionThrown(NamingExceptionEvent event) {
- Logging.unexpectedException(Logging.getLogger(Loggers.SYSTEM),
+ Logging.unexpectedException(getLogger(Loggers.SYSTEM),
Listener.class, "namingExceptionThrown", event.getException());
objectChanged(null);
}
@@ -388,7 +389,7 @@ public abstract class Initializer {
}
}
} catch (IOException e) {
- Logging.unexpectedException(Logging.getLogger(Loggers.SQL), Initializer.class, "getDataSource", e);
+ Logging.unexpectedException(getLogger(Loggers.SQL), Initializer.class, "getDataSource", e);
// Continue - the system will fallback on the hard-coded subset of EPSG definitions.
}
}
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/LocalDataSource.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/LocalDataSource.java
index 2e9b3c081d..2ad9e387d7 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/LocalDataSource.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/metadata/sql/LocalDataSource.java
@@ -37,6 +37,8 @@ import org.apache.sis.internal.system.DataDirectory;
import org.apache.sis.internal.system.DefaultFactories;
import org.apache.sis.internal.util.Strings;
+import static java.util.logging.Logger.getLogger;
+
/**
* A data source for a database stored locally in the {@code $SIS_DATA} directory.
@@ -128,7 +130,7 @@ public final class LocalDataSource implements DataSource, Comparable<LocalDataSo
path = Paths.get(home).relativize(path);
} catch (IllegalArgumentException | SecurityException e) {
// The path can not be relativized. This is okay.
- Logging.recoverableException(Logging.getLogger(Loggers.SQL), LocalDataSource.class, "<init>", e);
+ Logging.recoverableException(getLogger(Loggers.SQL), LocalDataSource.class, "<init>", e);
}
path = path.normalize();
dbFile = path.toString().replace(path.getFileSystem().getSeparator(), "/");
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/CitationConstant.java b/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/CitationConstant.java
index 727627b1b4..34095c93f9 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/CitationConstant.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/internal/simple/CitationConstant.java
@@ -36,6 +36,8 @@ import org.apache.sis.internal.system.Loggers;
import org.apache.sis.internal.util.Strings;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* Base class for the {@code public static final Citation} constants defined in some SIS classes.
@@ -181,7 +183,7 @@ public class CitationConstant extends SimpleCitation {
* the MetadataFallback class. So if we get this exception, a more serious error occurred.
* It is still not fatal however, since most of Citation content is informative.
*/
- Logging.unexpectedException(Logging.getLogger(Loggers.SQL), CitationConstant.class, "delegate", e);
+ Logging.unexpectedException(getLogger(Loggers.SQL), CitationConstant.class, "delegate", e);
c = new SimpleCitation(title);
}
delegate = c;
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
index d0f1a2879f..a0ebf71833 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/PropertyInformation.java
@@ -36,6 +36,8 @@ import org.apache.sis.util.Numbers;
import org.apache.sis.util.collection.CheckedContainer;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* Description of a metadata property inferred from Java reflection.
@@ -272,8 +274,7 @@ final class PropertyInformation<E> extends SimpleIdentifier // Impleme
* to have an IllegalArgumentException while he didn't provided any argument.
* Returning null as a fallback is compliant with the method contract.
*/
- Logging.unexpectedException(Logging.getLogger(Modules.METADATA),
- PropertyInformation.class, "getDomainValue", e);
+ Logging.unexpectedException(getLogger(Modules.METADATA), PropertyInformation.class, "getDomainValue", e);
domain = null;
}
domainValue = domain;
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java
index 18db579ad2..b54389bc7b 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/StandardImplementation.java
@@ -26,6 +26,8 @@ import org.apache.sis.util.CharSequences;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.Modules;
+import static java.util.logging.Logger.getLogger;
+
/**
* Information about an Apache SIS metadata standard implementation.
@@ -158,8 +160,7 @@ final class StandardImplementation extends MetadataStandard {
implementations.put(type, candidate);
return candidate.asSubclass(type);
} catch (ClassNotFoundException e) {
- Logging.recoverableException(Logging.getLogger(Modules.METADATA),
- MetadataStandard.class, "getImplementation", e);
+ Logging.recoverableException(getLogger(Modules.METADATA), MetadataStandard.class, "getImplementation", e);
}
implementations.put(type, Void.TYPE); // Marker for "class not found".
}
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/CachedStatement.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/CachedStatement.java
index ce862e9669..90614106fb 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/CachedStatement.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/CachedStatement.java
@@ -25,7 +25,6 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
-import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.internal.system.Loggers;
@@ -55,7 +54,7 @@ final class CachedStatement implements AutoCloseable {
/**
* Where to log warnings.
*/
- static final Logger LOGGER = Logging.getLogger(Loggers.SQL);
+ static final Logger LOGGER = Logger.getLogger(Loggers.SQL);
/**
* The interface for which the prepared statement has been created.
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/util/iso/Types.java b/core/sis-metadata/src/main/java/org/apache/sis/util/iso/Types.java
index d5433d4bc8..7fa0879c9f 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/util/iso/Types.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/util/iso/Types.java
@@ -48,6 +48,8 @@ import org.apache.sis.internal.util.CodeLists;
import org.apache.sis.internal.system.Loggers;
import org.apache.sis.internal.system.Modules;
+import static java.util.logging.Logger.getLogger;
+
/**
* Static methods working on GeoAPI types and {@link CodeList} values.
@@ -393,7 +395,7 @@ public final class Types extends Static {
try {
return super.toString(locale);
} catch (MissingResourceException e) {
- Logging.ignorableException(Logging.getLogger(Loggers.LOCALIZATION), ResourceInternationalString.class, "toString", e);
+ Logging.ignorableException(getLogger(Loggers.LOCALIZATION), ResourceInternationalString.class, "toString", e);
return fallback();
}
}
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/xml/LegacyCodes.java b/core/sis-metadata/src/main/java/org/apache/sis/xml/LegacyCodes.java
index 5ba2dc4e62..7408ac13d7 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/xml/LegacyCodes.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/xml/LegacyCodes.java
@@ -27,6 +27,8 @@ import org.apache.sis.internal.system.Loggers;
import org.apache.sis.util.collection.Containers;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* Mapping between some legacy codes (e.g. ISO 19115:2003) and newer codes (e.g. ISO 19115:2014).
@@ -54,7 +56,7 @@ final class LegacyCodes {
try (InputStream in = Metadata.class.getResourceAsStream("2003/charset-codes.properties")) {
codes.load(in);
} catch (IOException e) {
- Logging.unexpectedException(Logging.getLogger(Loggers.XML), ValueConverter.class, "toCharset[Code]", e);
+ Logging.unexpectedException(getLogger(Loggers.XML), ValueConverter.class, "toCharset[Code]", e);
}
final int capacity = Containers.hashMapCapacity(codes.size());
IANA_TO_LEGACY = new HashMap<>(capacity);
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/xml/MarshallerPool.java b/core/sis-metadata/src/main/java/org/apache/sis/xml/MarshallerPool.java
index 84ae0ca9c0..76edc4fb77 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/xml/MarshallerPool.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/xml/MarshallerPool.java
@@ -36,6 +36,8 @@ import org.apache.sis.internal.util.Constants;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.CharSequences;
+import static java.util.logging.Logger.getLogger;
+
/**
* Creates and configures {@link Marshaller} or {@link Unmarshaller} objects for use with SIS.
@@ -211,7 +213,7 @@ public class MarshallerPool {
* Not expected to happen because we are supposed
* to reset the properties to their initial values.
*/
- Logging.unexpectedException(Logging.getLogger(Loggers.XML), MarshallerPool.class, "recycle", exception);
+ Logging.unexpectedException(getLogger(Loggers.XML), MarshallerPool.class, "recycle", exception);
return;
}
queue.push(marshaller);
diff --git a/core/sis-metadata/src/main/java/org/apache/sis/xml/XLink.java b/core/sis-metadata/src/main/java/org/apache/sis/xml/XLink.java
index 03bce5dcc5..6acec0c261 100644
--- a/core/sis-metadata/src/main/java/org/apache/sis/xml/XLink.java
+++ b/core/sis-metadata/src/main/java/org/apache/sis/xml/XLink.java
@@ -31,6 +31,8 @@ import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.internal.system.Loggers;
+import static java.util.logging.Logger.getLogger;
+
/**
* The XML attributes defined by OGC in the
@@ -867,7 +869,7 @@ public class XLink implements Serializable {
}
} catch (NoSuchFieldException e) {
// Should never happen with Enums. But if it happen anyway, this is not a fatal error.
- Logging.unexpectedException(Logging.getLogger(Loggers.XML), XLink.class, "toString", e);
+ Logging.unexpectedException(getLogger(Loggers.XML), XLink.class, "toString", e);
}
buffer.append(label).append("=\"").append(value).append('"');
}
diff --git a/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphicTest.java b/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphicTest.java
index d353dd4d99..16887f1248 100644
--- a/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphicTest.java
+++ b/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/identification/DefaultBrowseGraphicTest.java
@@ -24,7 +24,6 @@ import javax.xml.bind.Marshaller;
import javax.xml.bind.JAXBException;
import javax.xml.transform.stream.StreamSource;
import org.opengis.metadata.identification.BrowseGraphic;
-import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.Version;
import org.apache.sis.xml.MarshallerPool;
import org.apache.sis.xml.Namespaces;
@@ -33,8 +32,9 @@ import org.apache.sis.test.xml.TestCase;
import org.apache.sis.test.DependsOnMethod;
import org.junit.Test;
-import static org.apache.sis.test.MetadataAssert.*;
+import static java.util.logging.Logger.getLogger;
import static java.util.Collections.singletonMap;
+import static org.apache.sis.test.MetadataAssert.*;
/**
@@ -305,7 +305,7 @@ public final strictfp class DefaultBrowseGraphicTest extends TestCase {
* In verbose mode, log the warning for allowing the developer to
* check the message. In normal mode, the test will be silent.
*/
- Logging.getLogger(warning.getLoggerName()).log(warning);
+ getLogger(warning.getLoggerName()).log(warning);
}
assertArrayEquals("FileName shall have precedence over CharacterString.",
new Object[] {"CharacterString", "FileName"}, warning.getParameters());
diff --git a/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/coverage/RenderingData.java b/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/coverage/RenderingData.java
index 18039f9f14..1ee35693cc 100644
--- a/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/coverage/RenderingData.java
+++ b/core/sis-portrayal/src/main/java/org/apache/sis/internal/map/coverage/RenderingData.java
@@ -69,6 +69,8 @@ import org.apache.sis.util.Utilities;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.portrayal.PlanarCanvas; // For javadoc.
+import static java.util.logging.Logger.getLogger;
+
/**
* The {@code RenderedImage} to draw in a {@link PlanarCanvas} together with transforms from pixel coordinates
@@ -768,7 +770,7 @@ public class RenderingData implements Cloneable {
* This method pretends that the warning come from {@link PlanarCanvas} class since it is the public API.
*/
private static void recoverableException(final Exception e) {
- Logging.recoverableException(Logging.getLogger(Modules.PORTRAYAL), PlanarCanvas.class, "render", e);
+ Logging.recoverableException(getLogger(Modules.PORTRAYAL), PlanarCanvas.class, "render", e);
}
/**
diff --git a/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java b/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
index 5e18072e72..7a9790140e 100644
--- a/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
+++ b/core/sis-referencing-by-identifiers/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
@@ -72,6 +72,8 @@ import org.apache.sis.math.DecimalFunctions;
import org.apache.sis.measure.Longitude;
import org.apache.sis.measure.Latitude;
+import static java.util.logging.Logger.getLogger;
+
// Branch-dependent imports
import org.apache.sis.internal.jdk9.JDK9;
import org.opengis.metadata.citation.Party;
@@ -277,7 +279,7 @@ public class MilitaryGridReferenceSystem extends ReferencingByIdentifiers {
party = MetadataSource.getProvided().lookup(Party.class, "{org}NATO");
} catch (MetadataStoreException e) {
party = null;
- Logging.unexpectedException(Logging.getLogger(Modules.REFERENCING_BY_IDENTIFIERS),
+ Logging.unexpectedException(getLogger(Modules.REFERENCING_BY_IDENTIFIERS),
MilitaryGridReferenceSystem.class, "<init>", e);
}
return properties(new NamedIdentifier(null, "NATO", Resources.formatInternational(Resources.Keys.MGRS), null, null), party);
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/geometry/CoordinateFormat.java b/core/sis-referencing/src/main/java/org/apache/sis/geometry/CoordinateFormat.java
index 3b56f5e708..7fd75e5ea1 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/geometry/CoordinateFormat.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/geometry/CoordinateFormat.java
@@ -69,6 +69,8 @@ import org.apache.sis.measure.UnitFormat;
import org.apache.sis.io.CompoundFormat;
import org.apache.sis.referencing.CRS;
+import static java.util.logging.Logger.getLogger;
+
/**
* Formats spatiotemporal coordinates using number, angle and date formats inferred from the coordinate system.
@@ -1779,7 +1781,7 @@ checkDirection: if (direction != null) {
* @param error the error that occurred.
*/
private static void unexpectedException(final String method, final Exception error) {
- Logging.unexpectedException(Logging.getLogger(Loggers.MEASURE), CoordinateFormat.class, method, error);
+ Logging.unexpectedException(getLogger(Loggers.MEASURE), CoordinateFormat.class, method, error);
}
/**
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java b/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java
index 5b906ae83c..f331abe68e 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/geometry/Envelopes.java
@@ -58,6 +58,7 @@ import org.apache.sis.util.Static;
import org.apache.sis.measure.Range;
import org.apache.sis.math.MathFunctions;
+import static java.util.logging.Logger.getLogger;
import static org.apache.sis.util.StringBuilders.trimFractionalPart;
@@ -270,7 +271,7 @@ public final class Envelopes extends Static {
* Note: we may succeed to transform `source` and fail to transform `target` to geographic bounding box,
* but the opposite is unlikely because `source` should not have less dimensions than `target`.
*/
- Logging.recoverableException(Logging.getLogger(Loggers.GEOMETRY), Envelopes.class, "findOperation", e);
+ Logging.recoverableException(getLogger(Loggers.GEOMETRY), Envelopes.class, "findOperation", e);
}
return CRS.findOperation(sourceCRS, targetCRS, areaOfInterest);
}
@@ -283,7 +284,7 @@ public final class Envelopes extends Static {
* Those exceptions must be minor enough that they can be silently ignored in most cases.
*/
static void recoverableException(final Class<? extends Static> caller, final TransformException exception) {
- Logging.recoverableException(Logging.getLogger(Loggers.GEOMETRY), caller, "transform", exception);
+ Logging.recoverableException(getLogger(Loggers.GEOMETRY), caller, "transform", exception);
}
/**
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/geometry/WraparoundAdjustment.java b/core/sis-referencing/src/main/java/org/apache/sis/geometry/WraparoundAdjustment.java
index 505b5f5fd4..a5578e2cac 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/geometry/WraparoundAdjustment.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/geometry/WraparoundAdjustment.java
@@ -35,6 +35,8 @@ import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.Utilities;
+import static java.util.logging.Logger.getLogger;
+
/**
* An envelope or position converter making them more compatible with a given domain of validity.
@@ -189,7 +191,7 @@ public class WraparoundAdjustment {
geographicDomainKnown = true; // Shall be set even in case of failure.
geographicDomain = ReferencingServices.getInstance().setBounds(domainOfValidity, null, null);
} catch (TransformException e) {
- Logging.ignorableException(Logging.getLogger(Loggers.COORDINATE_OPERATION), WraparoundAdjustment.class, "<init>", e);
+ Logging.ignorableException(getLogger(Loggers.COORDINATE_OPERATION), WraparoundAdjustment.class, "<init>", e);
// No more attempt will be done.
}
try {
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DatabaseListener.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DatabaseListener.java
index 0e8f7e1eb9..6d095d9471 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DatabaseListener.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/DatabaseListener.java
@@ -25,6 +25,8 @@ import org.apache.sis.internal.metadata.sql.Initializer;
import org.apache.sis.internal.system.Loggers;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* Invoked when a new database is created or when the data source changed.
@@ -67,7 +69,7 @@ public final class DatabaseListener extends Initializer {
((MultiAuthoritiesFactory) CRS.getAuthorityFactory(null)).reload();
} catch (FactoryException e) {
// Should never happen for a null argument given to CRS.getAuthorityFactory(…).
- Logging.unexpectedException(Logging.getLogger(Loggers.CRS_FACTORY), CRS.class, "getAuthorityFactory", e);
+ Logging.unexpectedException(getLogger(Loggers.CRS_FACTORY), CRS.class, "getAuthorityFactory", e);
}
}
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
index b9ebfa81ff..88bf198f26 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
@@ -68,6 +68,8 @@ import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.Exceptions;
import org.apache.sis.util.Utilities;
+import static java.util.logging.Logger.getLogger;
+
/**
* Implements the referencing services needed by the {@code "sis-metadata"} module.
@@ -146,7 +148,7 @@ public final class ServicesForMetadata extends ReferencingServices {
} catch (FactoryException e) {
if (findOpCaller != null) {
// See javadoc for the assumption that optional mode is used by Envelopes.findOperation(…).
- Logging.recoverableException(Logging.getLogger(Modules.REFERENCING), Envelopes.class, findOpCaller, e);
+ Logging.recoverableException(getLogger(Modules.REFERENCING), Envelopes.class, findOpCaller, e);
return null;
}
throw new TransformException(Resources.format(Resources.Keys.CanNotTransformEnvelopeToGeodetic), e);
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
index 8620310e7e..04e7add83c 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/AbstractProvider.java
@@ -41,6 +41,8 @@ import org.apache.sis.util.Workaround;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.Loggers;
+import static java.util.logging.Logger.getLogger;
+
/**
* Base class for all providers defined in this package.
@@ -279,6 +281,6 @@ public abstract class AbstractProvider extends DefaultOperationMethod implements
* @param e the error that occurred.
*/
static void recoverableException(final Class<? extends AbstractProvider> caller, Exception e) {
- Logging.recoverableException(Logging.getLogger(Loggers.COORDINATE_OPERATION), caller, "createMathTransform", e);
+ Logging.recoverableException(getLogger(Loggers.COORDINATE_OPERATION), caller, "createMathTransform", e);
}
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java
index 05b9de192e..ff3ecc2773 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java
@@ -45,6 +45,8 @@ import org.apache.sis.referencing.operation.transform.MathTransforms;
import org.apache.sis.referencing.operation.transform.LinearTransform;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* The base class of operation methods performing a translation, rotation and/or scale in geocentric coordinates.
@@ -435,7 +437,7 @@ public abstract class GeocentricAffine extends GeodeticOperation {
* Should not occur, except sometime on inverse transform of relatively complex datum shifts
* (more than just translation terms). We can fallback on formatting the full matrix.
*/
- Logging.recoverableException(Logging.getLogger(Loggers.WKT), GeocentricAffine.class, "asDatumShift", e);
+ Logging.recoverableException(getLogger(Loggers.WKT), GeocentricAffine.class, "asDatumShift", e);
continue;
}
final boolean isTranslation = parameters.isTranslation();
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/AbstractParser.java b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/AbstractParser.java
index f7bec9b0ae..ac61ec560c 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/AbstractParser.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/io/wkt/AbstractParser.java
@@ -38,7 +38,6 @@ import org.apache.sis.internal.util.StandardDateFormat;
import org.apache.sis.measure.Units;
import org.apache.sis.measure.UnitFormat;
import org.apache.sis.util.CharSequences;
-import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
@@ -216,7 +215,7 @@ abstract class AbstractParser implements Parser {
* or when the information is not worth to report as a warning.
*/
final void log(final LogRecord record) {
- Logger logger = Logging.getLogger(Loggers.WKT);
+ Logger logger = Logger.getLogger(Loggers.WKT);
record.setSourceClassName (getPublicFacade());
record.setSourceMethodName(getFacadeMethod());
record.setLoggerName(logger.getName());
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java b/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
index 9c1844a385..ed8282e550 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/parameter/DefaultParameterValue.java
@@ -57,6 +57,7 @@ import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.UnconvertibleObjectException;
+import static java.util.logging.Logger.getLogger;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
import static org.apache.sis.util.Utilities.deepEquals;
@@ -598,7 +599,7 @@ public class DefaultParameterValue<T> extends FormattableObject implements Param
* Level.FINE (not WARNING) because this log duplicates the exception
* that `setValue(Object, Unit)` may throw (with a better message).
*/
- Logging.recoverableException(Logging.getLogger(Loggers.COORDINATE_OPERATION),
+ Logging.recoverableException(getLogger(Loggers.COORDINATE_OPERATION),
DefaultParameterValue.class, "setValue", e);
} else {
/*
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
index 32951af0b5..82c14ca150 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CRS.java
@@ -90,6 +90,8 @@ import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.Utilities;
import org.apache.sis.util.Static;
+import static java.util.logging.Logger.getLogger;
+
// Branch-dependent imports
import org.opengis.geometry.Geometry;
@@ -424,7 +426,7 @@ public final class CRS extends Static {
record.setSourceClassName(CRS.class.getName());
record.setSourceMethodName("fromAuthority");
if (warningFilter.isLoggable(record)) {
- Logging.getLogger(Modules.REFERENCING).log(record);
+ getLogger(Modules.REFERENCING).log(record);
}
}
}
@@ -1433,6 +1435,6 @@ check: while (lower != 0 || upper != dimension) {
* <strong>must</strong> have a reasonable fallback (otherwise it should propagate the exception).
*/
private static void unexpectedException(final String methodName, final Exception exception) {
- Logging.unexpectedException(Logging.getLogger(Modules.REFERENCING), CRS.class, methodName, exception);
+ Logging.unexpectedException(getLogger(Modules.REFERENCING), CRS.class, methodName, exception);
}
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
index 18122a935d..f9ddfcb9e5 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
@@ -86,6 +86,7 @@ import org.apache.sis.math.MathFunctions;
import org.apache.sis.measure.Latitude;
import org.apache.sis.measure.Units;
+import static java.util.logging.Logger.getLogger;
import static java.util.Collections.singletonMap;
import static org.opengis.referencing.IdentifiedObject.NAME_KEY;
import static org.apache.sis.internal.util.StandardDateFormat.MILLISECONDS_PER_DAY;
@@ -529,7 +530,7 @@ public enum CommonCRS {
if (code != null) try {
epsg = Integer.parseInt(code);
} catch (NumberFormatException e) {
- Logging.recoverableException(Logging.getLogger(Modules.REFERENCING), CommonCRS.class, "forDatum", e);
+ Logging.recoverableException(getLogger(Modules.REFERENCING), CommonCRS.class, "forDatum", e);
}
}
for (final CommonCRS c : values()) {
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
index 50501b0073..be3c1e1e4c 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/IdentifiedObjects.java
@@ -50,6 +50,7 @@ import org.apache.sis.referencing.factory.IdentifiedObjectFinder;
import org.apache.sis.referencing.factory.GeodeticAuthorityFactory;
import org.apache.sis.referencing.factory.NoSuchAuthorityFactoryException;
+import static java.util.logging.Logger.getLogger;
import static org.apache.sis.internal.util.CollectionsExt.nonNull;
@@ -569,7 +570,7 @@ public final class IdentifiedObjects extends Static {
* Logs a warning for a non-critical error. The callers should have a fallback.
*/
private static void warning(final String method, final Exception e) {
- Logging.recoverableException(Logging.getLogger(Modules.REFERENCING), IdentifiedObjects.class, method, e);
+ Logging.recoverableException(getLogger(Modules.REFERENCING), IdentifiedObjects.class, method, e);
}
/**
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
index 2e7a55abab..46207ca1d4 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/crs/DefaultProjectedCRS.java
@@ -50,6 +50,7 @@ import org.apache.sis.io.wkt.Formatter;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
import static org.apache.sis.internal.referencing.WKTUtilities.toFormattable;
@@ -477,7 +478,7 @@ public class DefaultProjectedCRS extends AbstractDerivedCRS<Projection> implemen
* Since the intent of this check was to skip those parameters anyway, it is okay
* for the purpose of WKT formatting if there are no parameters for axis lengths.
*/
- Logging.recoverableException(Logging.getLogger(Loggers.WKT), DefaultProjectedCRS.class, "formatTo", e);
+ Logging.recoverableException(getLogger(Loggers.WKT), DefaultProjectedCRS.class, "formatTo", e);
continue;
}
if (Double.isNaN(value)) {
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
index 057cb31de4..cd5fef4ddb 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AbstractCS.java
@@ -51,6 +51,7 @@ import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
+import static java.util.logging.Logger.getLogger;
import static org.apache.sis.util.ArgumentChecks.*;
@@ -420,7 +421,7 @@ public class AbstractCS extends AbstractIdentifiedObject implements CoordinateSy
* Other exceptions would probably be more serious errors, but it still non-fatal
* for this method since we can continue with what Normalizer created.
*/
- Logging.recoverableException(Logging.getLogger(Modules.REFERENCING), getClass(), "forConvention", e);
+ Logging.recoverableException(getLogger(Modules.REFERENCING), getClass(), "forConvention", e);
}
}
return this;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
index 59b8342252..cedd912c7b 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/CoordinateSystems.java
@@ -49,6 +49,8 @@ import org.apache.sis.internal.referencing.Resources;
import org.apache.sis.referencing.operation.matrix.Matrices;
import org.apache.sis.referencing.operation.matrix.MatrixSIS;
+import static java.util.logging.Logger.getLogger;
+
/**
* Utility methods working on {@link CoordinateSystem} objects and their axes.
@@ -651,7 +653,7 @@ forDim: switch (axes.length) {
break forDim;
}
} catch (IncommensurableException e) { // Should never happen since we checked that units are angular.
- Logging.unexpectedException(Logging.getLogger(Modules.REFERENCING), CoordinateSystems.class, "getEpsgCode", e);
+ Logging.unexpectedException(getLogger(Modules.REFERENCING), CoordinateSystems.class, "getEpsgCode", e);
break forDim;
}
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java
index 9265f6ca59..ab7d6d11c0 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/DirectionAlongMeridian.java
@@ -32,6 +32,8 @@ import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
+import static java.util.logging.Logger.getLogger;
+
/**
* Parses {@linkplain AxisDirection axis direction} of the kind <cite>"South along 90 deg East"</cite>.
@@ -123,7 +125,7 @@ final class DirectionAlongMeridian extends FormattableObject implements Comparab
try {
candidate = parse(direction.name());
} catch (IllegalArgumentException e) {
- Logging.recoverableException(Logging.getLogger(Modules.REFERENCING), DirectionAlongMeridian.class, "parse", e);
+ Logging.recoverableException(getLogger(Modules.REFERENCING), DirectionAlongMeridian.class, "parse", e);
return null;
}
if (candidate != null) {
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
index fcea85fd60..35d1271472 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DefaultGeodeticDatum.java
@@ -51,6 +51,7 @@ import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.CharSequences;
import org.apache.sis.io.wkt.Formatter;
+import static java.util.logging.Logger.getLogger;
import static org.apache.sis.util.Utilities.deepEquals;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
import static org.apache.sis.util.ArgumentChecks.ensureNonNullElement;
@@ -440,7 +441,7 @@ public class DefaultGeodeticDatum extends AbstractDatum implements GeodeticDatum
* is defined in such a way that matrix should always be invertible. If it happen anyway,
* returning 'null' is allowed by this method's contract.
*/
- Logging.unexpectedException(Logging.getLogger(Loggers.COORDINATE_OPERATION),
+ Logging.unexpectedException(getLogger(Loggers.COORDINATE_OPERATION),
DefaultGeodeticDatum.class, "getPositionVectorTransformation", e);
}
/*
@@ -474,7 +475,7 @@ public class DefaultGeodeticDatum extends AbstractDatum implements GeodeticDatum
Matrix m = MatrixSIS.castOrCopy(step2).inverse().multiply(step1);
return AnnotatedMatrix.indirect(m, useAOI);
} catch (NoninvertibleMatrixException e) {
- Logging.unexpectedException(Logging.getLogger(Loggers.COORDINATE_OPERATION),
+ Logging.unexpectedException(getLogger(Loggers.COORDINATE_OPERATION),
DefaultGeodeticDatum.class, "getPositionVectorTransformation", e);
}
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java
index 96a33a0826..fe06784f67 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java
@@ -53,6 +53,8 @@ import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.SimpleInternationalString;
+import static java.util.logging.Logger.getLogger;
+
/**
* Creates coordinate reference systems in the "{@code OGC}", "{@code CRS}" or {@code "AUTO(2)"} namespaces.
@@ -279,7 +281,7 @@ public class CommonAuthorityFactory extends GeodeticAuthorityFactory implements
try {
return format(Integer.parseInt(code.substring(skipNamespace(code) & ~LEGACY_MASK)));
} catch (NoSuchAuthorityCodeException | NumberFormatException e) {
- Logging.recoverableException(Logging.getLogger(Loggers.CRS_FACTORY), CommonAuthorityFactory.class, "reformat", e);
+ Logging.recoverableException(getLogger(Loggers.CRS_FACTORY), CommonAuthorityFactory.class, "reformat", e);
return null;
}
}
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 b359ab382b..39fd0491af 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
@@ -63,6 +63,8 @@ import org.apache.sis.util.logging.PerformanceLevel;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.resources.Messages;
+import static java.util.logging.Logger.getLogger;
+
/**
* A concurrent authority factory that caches all objects created by another factory.
@@ -659,7 +661,7 @@ public abstract class ConcurrentAuthorityFactory<DAO extends GeodeticAuthorityFa
* @param exception the exception that occurred while closing a Data Access Object.
*/
static void unexpectedException(final String method, final Exception exception) {
- Logging.unexpectedException(Logging.getLogger(Loggers.CRS_FACTORY),
+ Logging.unexpectedException(getLogger(Loggers.CRS_FACTORY),
ConcurrentAuthorityFactory.class, method, exception);
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java
index 55638bf231..dd78309668 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/GeodeticObjectFactory.java
@@ -58,7 +58,6 @@ import org.apache.sis.util.collection.WeakHashSet;
import org.apache.sis.util.iso.AbstractFactory;
import org.apache.sis.util.resources.Messages;
import org.apache.sis.util.resources.Errors;
-import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.io.wkt.Parser;
import org.apache.sis.util.Exceptions;
@@ -199,7 +198,7 @@ public class GeodeticObjectFactory extends AbstractFactory implements CRSFactory
/**
* The logger to use for reporting object creations.
*/
- private static final Logger LOGGER = Logging.getLogger(Loggers.CRS_FACTORY);
+ private static final Logger LOGGER = Logger.getLogger(Loggers.CRS_FACTORY);
/**
* The constructor for WKT parsers, fetched when first needed. The WKT parser is defined in the
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/CloseableReference.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/CloseableReference.java
index 9868b47e82..9bfefea9e3 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/CloseableReference.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/CloseableReference.java
@@ -24,6 +24,8 @@ import org.apache.sis.internal.system.ReferenceQueueConsumer;
import org.apache.sis.util.Disposable;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* Closes JDBC statements when {@link AuthorityCodes} is garbage collected.
@@ -104,7 +106,7 @@ final class CloseableReference extends WeakReference<AuthorityCodes> implements
* Pretend that the logging come from AuthorityCodes because it is closer to a public API (or at
* least, easier to guess that it is related to the EPSGDataAccess.getAuthorityCodes() method).
*/
- Logging.unexpectedException(Logging.getLogger(Loggers.CRS_FACTORY), AuthorityCodes.class, "close", exception);
+ Logging.unexpectedException(getLogger(Loggers.CRS_FACTORY), AuthorityCodes.class, "close", exception);
}
}
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGCodeFinder.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGCodeFinder.java
index fc1537d0f0..193c695a75 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGCodeFinder.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGCodeFinder.java
@@ -55,6 +55,7 @@ import org.apache.sis.util.CharSequences;
import org.apache.sis.util.collection.Containers;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
import static org.apache.sis.internal.metadata.NameToIdentifier.Simplifier.ESRI_DATUM_PREFIX;
@@ -147,7 +148,7 @@ final class EPSGCodeFinder extends IdentifiedObjectFinder {
if (id != null) try { // Should never be null, but let be safe.
filters.add(Integer.parseInt(id.getCode()));
} catch (NumberFormatException e) {
- Logging.recoverableException(Logging.getLogger(Loggers.CRS_FACTORY), EPSGCodeFinder.class, "getCodeCandidates", e);
+ Logging.recoverableException(getLogger(Loggers.CRS_FACTORY), EPSGCodeFinder.class, "getCodeCandidates", e);
}
}
if (!filters.isEmpty()) {
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
index 304e8766ed..112e16d0b0 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java
@@ -119,6 +119,7 @@ import org.apache.sis.measure.MeasurementRange;
import org.apache.sis.measure.NumberRange;
import org.apache.sis.measure.Units;
+import static java.util.logging.Logger.getLogger;
import static org.apache.sis.util.Utilities.equalsIgnoreMetadata;
import static org.apache.sis.internal.util.StandardDateFormat.UTC;
import static org.apache.sis.internal.referencing.ServicesForMetadata.CONNECTION;
@@ -492,8 +493,7 @@ addURIs: for (int i=0; ; i++) {
r.setLinkage(new URI(url));
} catch (URISyntaxException exception) {
// May happen if there is spaces in the URI.
- Logging.recoverableException(Logging.getLogger(Loggers.CRS_FACTORY),
- EPSGDataAccess.class, "getAuthority", exception);
+ Logging.recoverableException(getLogger(Loggers.CRS_FACTORY), EPSGDataAccess.class, "getAuthority", exception);
}
r.setFunction(function);
r.setDescription(description);
@@ -3333,7 +3333,7 @@ next: while (r.next()) {
* @param exception the exception to log.
*/
private static void unexpectedException(final String method, final Exception exception) {
- Logging.unexpectedException(Logging.getLogger(Loggers.CRS_FACTORY), EPSGDataAccess.class, method, exception);
+ Logging.unexpectedException(getLogger(Loggers.CRS_FACTORY), EPSGDataAccess.class, method, exception);
}
/**
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
index 334951d3ac..dd552661ae 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java
@@ -74,6 +74,7 @@ import org.apache.sis.internal.system.Semaphores;
import org.apache.sis.internal.system.Loggers;
import org.apache.sis.io.wkt.Convention;
+import static java.util.logging.Logger.getLogger;
import static org.apache.sis.util.Utilities.deepEquals;
@@ -905,7 +906,7 @@ check: for (int isTarget=0; ; isTarget++) { // 0 == source check; 1
this.getTargetCRS().getCoordinateSystem()));
tr2 = MathTransforms.concatenate(before, tr2, after);
} catch (IncommensurableException | RuntimeException e) {
- Logging.ignorableException(Logging.getLogger(Loggers.COORDINATE_OPERATION),
+ Logging.ignorableException(getLogger(Loggers.COORDINATE_OPERATION),
AbstractCoordinateOperation.class, "equals", e);
}
if (deepEquals(tr1, tr2, mode)) return true;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
index daa0a9ff05..3991cc6240 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/CoordinateOperationRegistry.java
@@ -81,6 +81,8 @@ import org.apache.sis.util.collection.Containers;
import org.apache.sis.util.collection.BackingStoreException;
import org.apache.sis.util.resources.Vocabulary;
+import static java.util.logging.Logger.getLogger;
+
/**
* Base class of code that search for coordinate operation, either by looking in a registry maintained by an authority
@@ -1346,7 +1348,7 @@ class CoordinateOperationRegistry {
* @param exception the exception which occurred, or {@code null} if a {@code record} is specified instead.
*/
static void recoverableException(final String method, final Exception exception) {
- Logging.recoverableException(Logging.getLogger(Loggers.COORDINATE_OPERATION),
+ Logging.recoverableException(getLogger(Loggers.COORDINATE_OPERATION),
CoordinateOperationFinder.class, method, exception);
}
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
index 2fc5829ec5..cbb7874eb3 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
@@ -62,6 +62,7 @@ import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.logging.Logging;
import static java.lang.Math.*;
+import static java.util.logging.Logger.getLogger;
/**
@@ -948,7 +949,7 @@ public abstract class NormalizedProjection extends AbstractMathTransform2D imple
}
}
} catch (NoninvertibleTransformException e) {
- Logging.recoverableException(Logging.getLogger(Loggers.COORDINATE_OPERATION),
+ Logging.recoverableException(getLogger(Loggers.COORDINATE_OPERATION),
(projection instanceof NormalizedProjection) ? NormalizedProjection.class : projection.getClass(),
"tryConcatenate", e);
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform.java
index 591d094e6d..cbb120876d 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ConcatenatedTransform.java
@@ -48,6 +48,8 @@ import org.apache.sis.io.wkt.FormattableObject;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
+import static java.util.logging.Logger.getLogger;
+
/**
* Base class for concatenated transforms. Instances can be created by calls to the
@@ -272,7 +274,7 @@ class ConcatenatedTransform extends AbstractMathTransform implements Serializabl
* Ignore. The `concatenated.inverse()` method will try to compute the inverse itself,
* possible at the cost of more NaN values than what above code would have produced.
*/
- Logging.recoverableException(Logging.getLogger(Loggers.COORDINATE_OPERATION),
+ Logging.recoverableException(getLogger(Loggers.COORDINATE_OPERATION),
ConcatenatedTransform.class, "create", e);
}
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
index 7b6de55c61..55534eb572 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/ContextualParameters.java
@@ -57,6 +57,8 @@ import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.ArraysExt;
+import static java.util.logging.Logger.getLogger;
+
/**
* The parameters that describe a sequence of
@@ -1012,6 +1014,6 @@ public class ContextualParameters extends Parameters implements Serializable {
* transform.</p>
*/
private static void unexpectedException(final IllegalStateException e) {
- Logging.unexpectedException(Logging.getLogger(Loggers.WKT), ConcatenatedTransform.class, "formatTo", e.getCause());
+ Logging.unexpectedException(getLogger(Loggers.WKT), ConcatenatedTransform.class, "formatTo", e.getCause());
}
}
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
index 0afee4202b..ff5ce4ac11 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/DefaultMathTransformFactory.java
@@ -84,6 +84,8 @@ import org.apache.sis.util.iso.AbstractFactory;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
+import static java.util.logging.Logger.getLogger;
+
/**
* Low level factory for creating {@linkplain AbstractMathTransform math transforms}.
@@ -910,7 +912,7 @@ public class DefaultMathTransformFactory extends AbstractFactory implements Math
* from another implementation. We can safely abandon our attempt to set the inverse flattening value,
* since it was redundant with semi-minor axis length.
*/
- Logging.recoverableException(Logging.getLogger(Loggers.COORDINATE_OPERATION),
+ Logging.recoverableException(getLogger(Loggers.COORDINATE_OPERATION),
DefaultMathTransformFactory.class, "createParameterizedTransform", e);
}
}
@@ -1094,7 +1096,7 @@ public class DefaultMathTransformFactory extends AbstractFactory implements Math
throw exception;
}
method = getOperationMethod(methodName);
- Logging.recoverableException(Logging.getLogger(Loggers.COORDINATE_OPERATION),
+ Logging.recoverableException(getLogger(Loggers.COORDINATE_OPERATION),
DefaultMathTransformFactory.class, "createParameterizedTransform", exception);
}
if (!(method instanceof MathTransformProvider)) {
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/WraparoundTransform.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/WraparoundTransform.java
index 2fbec993c7..7b2db92578 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/WraparoundTransform.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/WraparoundTransform.java
@@ -38,6 +38,8 @@ import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.ComparisonMode;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* Enforces coordinate values in the range of a wraparound axis (typically longitude).
@@ -525,7 +527,7 @@ public class WraparoundTransform extends AbstractMathTransform implements Serial
}
} catch (NoninvertibleTransformException e) {
// Should not happen. But if it is the case, just abandon the optimization effort.
- Logging.recoverableException(Logging.getLogger(Modules.REFERENCING), getClass(), "tryConcatenate", e);
+ Logging.recoverableException(getLogger(Modules.REFERENCING), getClass(), "tryConcatenate", e);
}
}
return null;
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactoryTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactoryTest.java
index a798f4e06a..ebd83373f1 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactoryTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/ConcurrentAuthorityFactoryTest.java
@@ -24,11 +24,11 @@ import java.util.concurrent.TimeUnit;
import java.lang.reflect.Field;
import org.opengis.util.FactoryException;
import org.apache.sis.internal.system.Loggers;
-import org.apache.sis.util.logging.Logging;
import org.apache.sis.test.DependsOn;
import org.apache.sis.test.TestCase;
import org.junit.Test;
+import static java.util.logging.Logger.getLogger;
import static org.junit.Assert.*;
import static org.junit.Assume.assumeTrue;
@@ -185,7 +185,7 @@ public final strictfp class ConcurrentAuthorityFactoryTest extends TestCase {
Thread.sleep(TimeUnit.NANOSECONDS.toMillis(waitTime));
int n = 3;
while (factory.isCleanScheduled()) {
- Logging.getLogger(Loggers.CRS_FACTORY)
+ getLogger(Loggers.CRS_FACTORY)
.warning("Execution of ConcurrentAuthorityFactory.disposeExpired() has been delayed.");
Thread.sleep(TIMEOUT);
System.gc();
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/TestFactorySource.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/TestFactorySource.java
index 34fe82474e..7e6b4f481d 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/TestFactorySource.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/factory/TestFactorySource.java
@@ -21,13 +21,13 @@ import java.util.HashMap;
import org.postgresql.ds.PGSimpleDataSource;
import org.opengis.util.FactoryException;
import org.opengis.referencing.crs.CRSAuthorityFactory;
-import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.Loggers;
import org.apache.sis.internal.util.Constants;
import org.apache.sis.internal.metadata.sql.Initializer;
import org.apache.sis.referencing.CRS;
import org.apache.sis.referencing.factory.sql.EPSGFactory;
+import static java.util.logging.Logger.getLogger;
import static org.junit.Assume.*;
import static org.opengis.test.Assert.*;
@@ -116,7 +116,7 @@ public final strictfp class TestFactorySource {
assertNotNull(factory.createGeographicCRS("4326"));
} catch (UnavailableFactoryException e) {
isUnavailable = true;
- Logging.getLogger(Loggers.CRS_FACTORY).warning(e.toString());
+ getLogger(Loggers.CRS_FACTORY).warning(e.toString());
assumeNoException("No connection to EPSG dataset.", e);
}
return (EPSGFactory) factory;
@@ -151,7 +151,7 @@ public final strictfp class TestFactorySource {
factory = af; // Must be last.
} catch (UnavailableFactoryException e) {
isUnavailable = true;
- Logging.getLogger(Loggers.CRS_FACTORY).warning(e.toString());
+ getLogger(Loggers.CRS_FACTORY).warning(e.toString());
} finally {
if (factory != af) {
af.close();
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/system/DataDirectory.java b/core/sis-utility/src/main/java/org/apache/sis/internal/system/DataDirectory.java
index 338acca688..3634957ea6 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/system/DataDirectory.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/system/DataDirectory.java
@@ -26,6 +26,8 @@ import java.util.logging.LogRecord;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Messages;
+import static java.util.logging.Logger.getLogger;
+
/**
* Sub-directories of {@code SIS_DATA} where SIS looks for EPSG database, datum shift grids and other resources.
@@ -156,7 +158,7 @@ public enum DataDirectory {
if (rootDirectory == null) try {
return getenv() == null;
} catch (SecurityException e) {
- Logging.recoverableException(Logging.getLogger(Loggers.SYSTEM), DataDirectory.class, "isUndefined", e);
+ Logging.recoverableException(getLogger(Loggers.SYSTEM), DataDirectory.class, "isUndefined", e);
}
return false;
}
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java b/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java
index bcca25d42d..b2ac1610e0 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/system/DefaultFactories.java
@@ -24,6 +24,8 @@ import java.util.ServiceLoader;
import java.util.ServiceConfigurationError;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* Default factories defined in the {@code sis-utility} module.
@@ -181,7 +183,7 @@ public final class DefaultFactories extends SystemListener {
* We were not allowed to invoke Thread.currentThread().getContextClassLoader().
* But ServiceLoader.load(Class) may be allowed to, since it is part of JDK.
*/
- Logging.recoverableException(Logging.getLogger(Loggers.SYSTEM),
+ Logging.recoverableException(getLogger(Loggers.SYSTEM),
DefaultFactories.class, "createServiceLoader", e);
return ServiceLoader.load(service);
}
@@ -227,7 +229,7 @@ public final class DefaultFactories extends SystemListener {
} catch (SecurityException | ClassNotFoundException e) {
if (!warnings) {
warnings = true;
- Logging.recoverableException(Logging.getLogger(Loggers.SYSTEM),
+ Logging.recoverableException(getLogger(Loggers.SYSTEM),
DefaultFactories.class, "getContextClassLoader", e);
}
}
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/system/DelayedExecutor.java b/core/sis-utility/src/main/java/org/apache/sis/internal/system/DelayedExecutor.java
index edf9efca14..97fff2fe41 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/system/DelayedExecutor.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/system/DelayedExecutor.java
@@ -21,6 +21,8 @@ import java.util.concurrent.DelayQueue;
import java.util.concurrent.BlockingQueue;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* A thread executing short tasks after some (potentially zero nanosecond) delay.
@@ -134,7 +136,7 @@ public final class DelayedExecutor extends DaemonThread {
* We need to test 'isKillRequested()' below.
*/
} catch (Throwable exception) {
- Logging.unexpectedException(Logging.getLogger(Loggers.SYSTEM), getClass(), "run", exception);
+ Logging.unexpectedException(getLogger(Loggers.SYSTEM), getClass(), "run", exception);
}
if (isKillRequested()) {
queue.clear();
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/system/Loggers.java b/core/sis-utility/src/main/java/org/apache/sis/internal/system/Loggers.java
index 382f21e9d2..2f8bf971d4 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/system/Loggers.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/system/Loggers.java
@@ -146,7 +146,7 @@ public final class Loggers extends Static {
* In such case forget the problematic fields and search the next one. This is okay
* since this method is only for information purpose.
*/
- Logging.unexpectedException(Logging.getLogger(SYSTEM), Loggers.class, "getEffectiveLevels", e);
+ Logging.unexpectedException(Logger.getLogger(SYSTEM), Loggers.class, "getEffectiveLevels", e);
}
}
/*
@@ -157,7 +157,7 @@ public final class Loggers extends Static {
while (it.hasNext()) {
final Map.Entry<String,Level> entry = it.next();
final String name = entry.getKey();
- final Logger logger = Logging.getLogger(name);
+ final Logger logger = Logger.getLogger(name);
Level level = getEffectiveLevel(logger);
final Level h = getHandlerLevel(logger);
if (h.intValue() > level.intValue()) {
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/system/ReferenceQueueConsumer.java b/core/sis-utility/src/main/java/org/apache/sis/internal/system/ReferenceQueueConsumer.java
index 9a2149004c..0fe8a848c4 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/system/ReferenceQueueConsumer.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/system/ReferenceQueueConsumer.java
@@ -21,6 +21,8 @@ import java.lang.ref.ReferenceQueue;
import org.apache.sis.util.Disposable;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* A thread processing all {@link Reference} instances enqueued in a {@link ReferenceQueue}.
@@ -127,7 +129,7 @@ public final class ReferenceQueueConsumer extends DaemonThread {
* We need to test 'isKillRequested()' below.
*/
} catch (Throwable exception) {
- Logging.unexpectedException(Logging.getLogger(Loggers.SYSTEM), getClass(), "run", exception);
+ Logging.unexpectedException(getLogger(Loggers.SYSTEM), getClass(), "run", exception);
}
if (isKillRequested()) {
break;
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/system/Shutdown.java b/core/sis-utility/src/main/java/org/apache/sis/internal/system/Shutdown.java
index 088b9fc403..6f858a9c54 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/system/Shutdown.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/system/Shutdown.java
@@ -22,6 +22,8 @@ import java.util.Objects;
import java.util.concurrent.Callable;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* A central place where to manage SIS shutdown process.
@@ -199,7 +201,7 @@ public final class Shutdown extends Thread {
Threads.shutdown(System.nanoTime() + 4000);
} catch (InterruptedException e) {
if (caller != null) {
- Logging.unexpectedException(Logging.getLogger(Loggers.SYSTEM), caller, "stop", e);
+ Logging.unexpectedException(getLogger(Loggers.SYSTEM), caller, "stop", e);
}
}
if (exception != null) {
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/system/Threads.java b/core/sis-utility/src/main/java/org/apache/sis/internal/system/Threads.java
index 6cf55cc81a..d1c7ee6302 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/system/Threads.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/system/Threads.java
@@ -19,6 +19,8 @@ package org.apache.sis.internal.system;
import org.apache.sis.util.Static;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* Utilities methods for threads. This class declares in a single place every {@link ThreadGroup} used in SIS.
@@ -61,7 +63,7 @@ public final class Threads extends Static {
*/
static final ThreadGroup DAEMONS = new ThreadGroup(SIS, "Daemons") {
@Override public void uncaughtException(final Thread thread, final Throwable exception) {
- Logging.severeException(Logging.getLogger(Loggers.SYSTEM), thread.getClass(), "run", exception);
+ Logging.severeException(getLogger(Loggers.SYSTEM), thread.getClass(), "run", exception);
}
};
diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java b/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
index a21b204245..0f6359b67e 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/internal/util/DefinitionURI.java
@@ -23,6 +23,7 @@ import org.apache.sis.util.CharSequences;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.Loggers;
+import static java.util.logging.Logger.getLogger;
import static org.apache.sis.util.CharSequences.*;
import static org.apache.sis.util.ArgumentChecks.ensureNonNull;
@@ -419,7 +420,7 @@ public final class DefinitionURI {
splitAt = s; // Set only on success.
} catch (NumberFormatException e) {
// Ignore. The URN is likely to be invalid, but we let parse(…) determines that.
- Logging.recoverableException(Logging.getLogger(Loggers.CRS_FACTORY), DefinitionURI.class, "parse", e);
+ Logging.recoverableException(getLogger(Loggers.CRS_FACTORY), DefinitionURI.class, "parse", e);
}
orderedComponents.put(sequenceNumber, parse(uri, isURN, splitAt, next));
splitAt = next;
diff --git a/core/sis-utility/src/main/java/org/apache/sis/math/Vector.java b/core/sis-utility/src/main/java/org/apache/sis/math/Vector.java
index 5059d6bf0e..d59cae0c28 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/math/Vector.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/math/Vector.java
@@ -33,6 +33,7 @@ import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.internal.system.Loggers;
+import static java.util.logging.Logger.getLogger;
import static org.apache.sis.util.ArgumentChecks.ensureValidIndex;
@@ -1478,7 +1479,7 @@ search: for (;;) {
* Logs a warning about an exception that can be safely ignored.
*/
final void warning(final String method, final RuntimeException e) {
- Logging.recoverableException(Logging.getLogger(Loggers.MATH), Vector.class, method, e);
+ Logging.recoverableException(getLogger(Loggers.MATH), Vector.class, method, e);
}
/**
diff --git a/core/sis-utility/src/main/java/org/apache/sis/measure/AbstractUnit.java b/core/sis-utility/src/main/java/org/apache/sis/measure/AbstractUnit.java
index 5ebe16f1d4..47bb1b69b8 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/measure/AbstractUnit.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/measure/AbstractUnit.java
@@ -33,6 +33,8 @@ import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.Loggers;
+import static java.util.logging.Logger.getLogger;
+
/**
* Base class of all unit implementations. There is conceptually 4 kinds of units,
@@ -300,7 +302,7 @@ abstract class AbstractUnit<Q extends Quantity<Q>> implements Unit<Q>, LenientCo
if (symbol != null) try {
return UnitFormat.getBundle(Locale.getDefault()).getString(symbol);
} catch (MissingResourceException e) {
- Logging.ignorableException(Logging.getLogger(Loggers.MEASURE), AbstractUnit.class, "getName", e);
+ Logging.ignorableException(getLogger(Loggers.MEASURE), AbstractUnit.class, "getName", e);
// Ignore as per this method contract.
}
return null;
diff --git a/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java b/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java
index 1beddf9926..d5df26e825 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/measure/UnitFormat.java
@@ -50,6 +50,8 @@ import org.apache.sis.util.CorruptedObjectException;
import org.apache.sis.util.collection.WeakValueHashMap;
import org.apache.sis.util.logging.Logging;
+import static java.util.logging.Logger.getLogger;
+
/**
* Parses and formats units of measurement as SI symbols, URI in OGC namespace or other symbols.
@@ -648,7 +650,7 @@ appPow: if (unit == null) {
try {
label = names.getString(label);
} catch (MissingResourceException e) {
- Logging.ignorableException(Logging.getLogger(Loggers.MEASURE), UnitFormat.class, "format", e);
+ Logging.ignorableException(getLogger(Loggers.MEASURE), UnitFormat.class, "format", e);
// Name not found; use the symbol as a fallback.
}
return toAppendTo.append(label);
diff --git a/core/sis-utility/src/main/java/org/apache/sis/measure/UnitServices.java b/core/sis-utility/src/main/java/org/apache/sis/measure/UnitServices.java
index 50aa386cb9..386e114762 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/measure/UnitServices.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/measure/UnitServices.java
@@ -35,6 +35,8 @@ import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.Characters;
+import static java.util.logging.Logger.getLogger;
+
/**
* The central point from which all unit services (parsing, formatting, listing, <i>etc</i>) can be obtained.
@@ -180,7 +182,7 @@ public class UnitServices extends ServiceProvider implements SystemOfUnitsServic
style = org.apache.sis.measure.UnitFormat.Style.valueOf(name);
} catch (IllegalArgumentException e) {
// JSR-363 specification mandate that we return null.
- Logging.recoverableException(Logging.getLogger(Loggers.MEASURE), UnitServices.class, "getUnitFormat", e);
+ Logging.recoverableException(getLogger(Loggers.MEASURE), UnitServices.class, "getUnitFormat", e);
return null;
}
org.apache.sis.measure.UnitFormat f = new org.apache.sis.measure.UnitFormat(locale);
diff --git a/core/sis-utility/src/main/java/org/apache/sis/setup/About.java b/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
index 7cdeca10e8..9083153d89 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/setup/About.java
@@ -31,6 +31,7 @@ import java.util.jar.Attributes;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
import java.util.logging.Level;
+import java.util.logging.Handler;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
@@ -44,7 +45,6 @@ import org.apache.sis.util.CharSequences;
import org.apache.sis.util.Exceptions;
import org.apache.sis.util.Version;
import org.apache.sis.util.logging.Logging;
-import org.apache.sis.util.logging.LoggerFactory;
import org.apache.sis.util.resources.Messages;
import org.apache.sis.util.resources.Vocabulary;
import org.apache.sis.util.collection.TreeTable;
@@ -56,8 +56,10 @@ import org.apache.sis.internal.system.Loggers;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.internal.system.Shutdown;
import org.apache.sis.internal.system.DataDirectory;
+import org.apache.sis.internal.jdk9.JDK9;
import static java.lang.System.getProperty;
+import static java.util.logging.Logger.getLogger;
import static org.apache.sis.util.collection.TableColumn.NAME;
import static org.apache.sis.util.collection.TableColumn.VALUE_AS_TEXT;
import static org.apache.sis.internal.util.StandardDateFormat.UTC;
@@ -336,7 +338,7 @@ fill: for (int i=0; ; i++) {
value = resources.getString(Vocabulary.Keys.EntryCount_1, children.length / 2);
} catch (ClassNotFoundException e) {
// sis-storage module not in the classpath.
- Logging.recoverableException(Logging.getLogger(Modules.STORAGE), About.class, "configuration", e);
+ Logging.recoverableException(getLogger(Modules.STORAGE), About.class, "configuration", e);
} catch (ReflectiveOperationException e) {
value = Exceptions.unwrap(e).toString();
}
@@ -347,15 +349,21 @@ fill: for (int i=0; ; i++) {
newSection = LOGGING;
if (sections.contains(LOGGING)) {
nameKey = Vocabulary.Keys.Implementation;
- final LoggerFactory<?> factory = Logging.getLoggerFactory();
- value = (factory != null) ? factory.getName() : "java.util.logging";
+ value = "java.util.logging";
+ for (final Handler handler : getLogger("").getHandlers()) {
+ final String c = JDK9.getPackageName(handler.getClass());
+ if (!value.equals(c)) {
+ value = c;
+ break;
+ }
+ }
}
break;
}
case 12: {
if (sections.contains(LOGGING)) {
nameKey = Vocabulary.Keys.Level;
- final Level level = Logging.getLogger("").getLevel(); // Root logger level.
+ final Level level = getLogger("").getLevel(); // Root logger level.
if (level == null) {
// May happen when some code outside Apache SIS define their own loggers.
value = resources.getString(Vocabulary.Keys.Unknown);
@@ -643,7 +651,7 @@ pathTree: for (int j=0; ; j++) {
}
}
if (error != null) {
- Logging.unexpectedException(Logging.getLogger(Modules.UTILITIES), About.class, "configuration", error);
+ Logging.unexpectedException(getLogger(Modules.UTILITIES), About.class, "configuration", error);
}
return true;
}
@@ -752,7 +760,7 @@ pathTree: for (int j=0; ; j++) {
try {
return country ? locale.getCountry() : locale.getISO3Language();
} catch (MissingResourceException e) {
- Logging.ignorableException(Logging.getLogger(Loggers.LOCALIZATION), About.class, "configuration", e);
+ Logging.ignorableException(getLogger(Loggers.LOCALIZATION), About.class, "configuration", e);
return null;
}
}
diff --git a/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java b/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java
index 8aebfad6b6..a1dce8c3c0 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/setup/OptionKey.java
@@ -18,18 +18,20 @@ package org.apache.sis.setup;
import java.util.Map;
import java.util.HashMap;
+import java.util.Locale;
+import java.util.TimeZone;
import java.nio.ByteBuffer;
import java.nio.charset.Charset;
import java.nio.file.OpenOption;
import java.nio.file.StandardOpenOption;
import java.io.Serializable;
import java.io.ObjectStreamException;
-import java.util.Locale;
-import java.util.TimeZone;
import org.apache.sis.util.ArgumentChecks;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.Modules;
+import static java.util.logging.Logger.getLogger;
+
/**
* Keys in a map of options for configuring various services
@@ -351,7 +353,7 @@ public class OptionKey<T> implements Serializable {
* we override the 'equals' and 'hashCode' methods. This option is likely to be ignored,
* but options are expected to be optional...
*/
- Logging.recoverableException(Logging.getLogger(Modules.UTILITIES), OptionKey.class, "readResolve", e);
+ Logging.recoverableException(getLogger(Modules.UTILITIES), OptionKey.class, "readResolve", e);
return this;
}
}
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java b/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java
index a61afc23f2..136667731b 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/Locales.java
@@ -30,6 +30,7 @@ import java.lang.reflect.Modifier;
import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.Loggers;
+import static java.util.logging.Logger.getLogger;
import static org.apache.sis.util.CharSequences.trimWhitespaces;
import static org.apache.sis.util.collection.Containers.hashMapCapacity;
@@ -82,7 +83,7 @@ public final class Locales extends Static {
* Not a big deal if this operation fails (this is actually just an
* optimization for reducing memory usage). Log a warning and stop.
*/
- Logging.unexpectedException(Logging.getLogger(Loggers.LOCALIZATION), Locales.class, "<clinit>", exception);
+ Logging.unexpectedException(getLogger(Loggers.LOCALIZATION), Locales.class, "<clinit>", exception);
}
}
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakEntry.java b/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakEntry.java
index 9665ca4e3c..11e4b64d46 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakEntry.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/collection/WeakEntry.java
@@ -23,7 +23,6 @@ import java.lang.ref.WeakReference;
import java.lang.reflect.Array;
import org.apache.sis.util.Disposable;
-import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.resources.Messages;
import org.apache.sis.internal.system.ReferenceQueueConsumer;
import org.apache.sis.internal.system.Modules;
@@ -66,7 +65,7 @@ abstract class WeakEntry<E> extends WeakReference<E> implements Disposable {
/**
* The logger where to logs collection events, if logging at the finest level is enabled.
*/
- private static final Logger LOGGER = Logging.getLogger(Modules.UTILITIES);
+ private static final Logger LOGGER = Logger.getLogger(Modules.UTILITIES);
/**
* The next entry, or {@code null} if there is none.
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/logging/DualLogger.java b/core/sis-utility/src/main/java/org/apache/sis/util/logging/DualLogger.java
deleted file mode 100644
index 48bda47eee..0000000000
--- a/core/sis-utility/src/main/java/org/apache/sis/util/logging/DualLogger.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.sis.util.logging;
-
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-
-/**
- * Redirects logging to two loggers. This is used only when more than one {@link LoggerFactory}
- * is found on the classpath. This should never happen, but if it happen anyway we will send the
- * log records to all registered loggers in order to have a behavior slightly more determinist
- * than picking an arbitrary logger.
- *
- * @author Martin Desruisseaux (IRD, Geomatys)
- * @version 0.3
- * @since 0.3
- * @module
- *
- * @deprecated Will be removed since there is now other mechanisms for redirecting logging.
- * See <a href="https://issues.apache.org/jira/browse/SIS-531">SIS-531</a>.
- */
-@Deprecated
-@SuppressWarnings("ClassWithMultipleLoggers")
-final class DualLogger extends LoggerAdapter {
- /**
- * The two loggers.
- */
- @SuppressWarnings("NonConstantLogger")
- private final Logger first, second;
-
- /**
- * Creates a new logger which will redirects the event to the two specified loggers.
- */
- DualLogger(final String name, final Logger first, final Logger second) {
- super(name);
- this.first = first;
- this.second = second;
- }
-
- /**
- * Sets the level for the two loggers.
- */
- @Override
- public void setLevel(final Level level) {
- first .setLevel(level);
- second.setLevel(level);
- }
-
- /**
- * Returns the finest level from the two loggers.
- */
- @Override
- public Level getLevel() {
- final Level v1 = first .getLevel();
- final Level v2 = second.getLevel();
- return (v1.intValue() < v2.intValue()) ? v1 : v2;
- }
-
- /**
- * Returns {@code true} if the specified level is loggable by at least one logger.
- */
- @Override
- public boolean isLoggable(final Level level) {
- return first.isLoggable(level) || second.isLoggable(level);
- }
-
- /**
- * Logs a record at the specified level.
- */
- @Override
- public void log(final Level level, final String message) {
- first .log(level, message);
- second.log(level, message);
- }
-
- /**
- * Logs a record at the specified level.
- */
- @Override
- public void log(final Level level, final String message, final Throwable thrown) {
- first .log(level, message, thrown);
- second.log(level, message, thrown);
- }
-
- @Override public void severe (String message) {first.severe (message); second.severe (message);}
- @Override public void warning(String message) {first.warning(message); second.warning(message);}
- @Override public void info (String message) {first.info (message); second.info (message);}
- @Override public void config (String message) {first.config (message); second.config (message);}
- @Override public void fine (String message) {first.fine (message); second.fine (message);}
- @Override public void finer (String message) {first.finer (message); second.finer (message);}
- @Override public void finest (String message) {first.finest (message); second.finest (message);}
-}
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/logging/DualLoggerFactory.java b/core/sis-utility/src/main/java/org/apache/sis/util/logging/DualLoggerFactory.java
deleted file mode 100644
index 3a0ad5b193..0000000000
--- a/core/sis-utility/src/main/java/org/apache/sis/util/logging/DualLoggerFactory.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.sis.util.logging;
-
-import java.util.logging.Logger;
-
-
-/**
- * Redirects logging to two loggers. This is used only when more than one {@link LoggerFactory}
- * is found on the classpath. This should never happen, but if it happen anyway we will send the
- * log records to all registered loggers in order to have a behavior slightly more determinist
- * than picking an arbitrary logger.
- *
- * @author Martin Desruisseaux (IRD, Geomatys)
- * @version 0.3
- * @since 0.3
- * @module
- *
- * @deprecated Will be removed since there is now other mechanisms for redirecting logging.
- * See <a href="https://issues.apache.org/jira/browse/SIS-531">SIS-531</a>.
- */
-@Deprecated
-final class DualLoggerFactory extends LoggerFactory<DualLogger> {
- /**
- * The factories of loggers on which to delegate logging events.
- */
- private final LoggerFactory<?> first, second;
-
- /**
- * Creates a new factory which will delegate the logging events to the loggers
- * created by the two given factories.
- */
- DualLoggerFactory(final LoggerFactory<?> first, final LoggerFactory<?> second) {
- super(DualLogger.class);
- this.first = first;
- this.second = second;
- }
-
- /**
- * Returns a comma-separated list of the logging frameworks.
- */
- @Override
- public String getName() {
- return first.getName() + ", " + second.getName();
- }
-
- /**
- * Returns the implementation to use for the logger of the specified name,
- * or {@code null} if the logger would delegates to Java logging anyway.
- */
- @Override
- protected DualLogger getImplementation(final String name) {
- return new DualLogger(name, first.getLogger(name), second.getLogger(name));
- }
-
- /**
- * Wraps the specified {@linkplain #getImplementation implementation} in a Java logger.
- */
- @Override
- protected Logger wrap(final String name, final DualLogger implementation) {
- return implementation;
- }
-
- /**
- * Returns the {@linkplain #getImplementation implementation} wrapped by the specified logger,
- * or {@code null} if none.
- */
- @Override
- protected DualLogger unwrap(final Logger logger) {
- if (logger instanceof DualLogger) {
- return (DualLogger) logger;
- }
- return null;
- }
-}
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/logging/LoggerAdapter.java b/core/sis-utility/src/main/java/org/apache/sis/util/logging/LoggerAdapter.java
deleted file mode 100644
index a04839b592..0000000000
--- a/core/sis-utility/src/main/java/org/apache/sis/util/logging/LoggerAdapter.java
+++ /dev/null
@@ -1,806 +0,0 @@
-/*
- * 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.sis.util.logging;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-import java.util.logging.Filter;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.logging.Handler;
-import java.util.logging.LogRecord;
-import java.util.regex.Pattern;
-
-import org.apache.sis.util.Debug;
-
-
-/**
- * An adapter that redirect all JDK logging events to an other logging framework. This
- * class redefines the {@link #severe(String) severe}, {@link #warning(String) warning},
- * {@link #info(String) info}, {@link #config(String) config}, {@link #fine(String) fine},
- * {@link #finer(String) finer} and {@link #finest(String) finest} methods as <em>abstract</em>
- * ones. Subclasses should implement those methods in order to map JDK logging levels to
- * the backend logging framework.
- *
- * <p>All {@link #log(Level,String) log} methods are overridden in order to redirect to one of the
- * above-cited methods. Note that this is the opposite approach than the JDK logging framework
- * one, which implements everything on top of {@link Logger#log(LogRecord)}. This adapter is
- * defined in terms of {@link #severe(String) severe} … {@link #finest(String) finest} methods
- * instead because external frameworks like <a href="http://commons.apache.org/logging/">Commons-logging</a>
- * don't work with {@link LogRecord}, and sometime provides nothing else than convenience methods
- * equivalent to {@link #severe(String) severe} … {@link #finest(String) finest}.</p>
- *
- * <h2>Restrictions</h2>
- * Because the configuration is expected to be fully controlled by the external logging
- * framework, every configuration methods inherited from {@link Logger} are disabled:
- *
- * <ul>
- * <li>{@link #addHandler(Handler)}
- * since the handling is performed by the external framework.</li>
- *
- * <li>{@link #setUseParentHandlers(boolean)}
- * since this adapter never delegates to the parent handlers. This is consistent with the
- * previous item and avoid mixing loggings from the external framework with JDK loggings.</li>
- *
- * <li>{@link #setParent(Logger)}
- * since this adapter should not inherits any configuration from a parent logger using the
- * JDK logging framework.</li>
- *
- * <li>{@link #setFilter(Filter)}
- * for keeping this {@code LoggerAdapter} simple.</li>
- * </ul>
- *
- * Since {@code LoggerAdapter}s do not hold any configuration by themselves, it is not strictly
- * necessary to {@linkplain java.util.logging.LogManager#addLogger add them to the log manager}.
- * The adapters can be created, garbage-collected and recreated again while preserving their
- * behavior since their configuration is entirely contained in the external logging framework.
- *
- * <h2>Localization</h2>
- * This logger is always created without resource bundles. Localizations shall be done through
- * explicit calls to {@code logrb} or {@link #log(LogRecord)} methods. This is sufficient for
- * SIS needs, which performs all localizations through the latter. Note that those methods
- * will be slower in this {@code LoggerAdapter} than the default {@link Logger} because this
- * adapter localizes and formats records immediately instead of letting the {@linkplain Handler}
- * performs this work only if needed.
- *
- * <h2>Logging levels</h2>
- * If a log record {@linkplain Level level} is not one of the predefined ones, then this class
- * maps to the first level below the specified one. For example if a log record has some level
- * between {@link Level#FINE FINE} and {@link Level#FINER FINER}, then the {@link #finer finer}
- * method will be invoked. See {@link #isLoggable(Level)} for implementation tips taking advantage
- * of this rule.
- *
- * @author Martin Desruisseaux (IRD, Geomatys)
- * @version 0.5
- *
- * @see Logging
- *
- * @since 0.3
- * @module
- *
- * @deprecated Will be removed since there is now other mechanisms for redirecting logging.
- * See <a href="https://issues.apache.org/jira/browse/SIS-531">SIS-531</a>.
- */
-@Deprecated
-public abstract class LoggerAdapter extends Logger {
- /**
- * The pattern to use for detecting {@link MessageFormat}.
- */
- private static final Pattern MESSAGE_FORMAT = Pattern.compile("\\{\\d+\\}");
-
- /**
- * Creates a new logger.
- *
- * @param name the logger name.
- */
- protected LoggerAdapter(final String name) {
- super(name, null);
- /*
- * Must invokes the super-class method, because LoggerAdapter overrides it as a no-op.
- */
- super.setUseParentHandlers(false);
- /*
- * Sets the level to ALL as a matter of principle, but we will never check the level
- * anyway (we will let the external logging framework do its own check). Note that we
- * must invoke the method in the super-class because we want to set the java logging
- * level, not the external framework level.
- */
- super.setLevel(Level.ALL);
- }
-
- /**
- * Sets the level for this logger. Subclasses must redirect the call to the external
- * logging framework, or do nothing if the level can not be changed programmatically.
- *
- * @param level the new value for the log level (may be null).
- */
- @Override
- public abstract void setLevel(Level level);
-
- /**
- * Returns the level for this logger. Subclasses shall get this level from the
- * external logging framework.
- *
- * @return the logger's level.
- */
- @Override
- public abstract Level getLevel();
-
- /**
- * Returns the level for {@link #entering(String, String) entering(…)}, {@link #exiting(String, String) exiting(…)}
- * and {@link #throwing(String, String, Throwable) throwing(…)} methods.
- * The default implementation returns {@link Level#FINER}, which is consistent with the
- * value used in the JDK logging framework. Subclasses should override this method if
- * a different debug level is wanted.
- *
- * @return the level to use for debugging information.
- */
- @Debug
- protected Level getDebugLevel() {
- return Level.FINER;
- }
-
- /**
- * Returns {@code true} if the specified level is loggable.
- *
- * <h4>Implementation tip</h4>
- * Given that {@link Level#intValue} for all predefined levels are documented in the {@link Level}
- * specification and are multiple of 100, given that integer divisions are rounded toward zero and
- * given rule documented in this <a href="#skip-navbar_top">class javadoc</a>, then logging levels
- * can be efficiently mapped to predefined levels using {@code switch} statements as below. This
- * statement has good chances to be compiled to the {@code tableswitch} bytecode rather than
- * {@code lookupswitch} (see
- * <a href="http://java.sun.com/docs/books/jvms/second_edition/html/Compiling.doc.html#14942">Compiling
- * Switches</a> in <cite>The Java Virtual Machine Specification</cite>).
- *
- * {@preformat java
- * public boolean isLoggable(Level level) {
- * final int n = level.intValue();
- * switch (n / 100) {
- * default: {
- * // MAX_VALUE is a special value for Level.OFF. Otherwise and
- * // if positive, fallthrough since we are greater than SEVERE.
- * switch (n) {
- * case Integer.MIN_VALUE: return true; // Level.ALL
- * case Integer.MAX_VALUE: return false; // Level.OFF
- * default: if (n < 0) return false;
- * }
- * }
- * case 10: return isSevereEnabled();
- * case 9: return isWarningEnabled();
- * case 8: return isInfoEnabled();
- * case 7: return isConfigEnabled();
- * case 6: // fallthrough
- * case 5: return isFineEnabled();
- * case 4: return isFinerEnabled();
- * case 3: return isFinestEnabled();
- * case 2: // fallthrough
- * case 1: // fallthrough
- * case 0: return false;
- * }
- * }
- * }
- *
- * @param level a message logging level.
- * @return {@code true} if the given message level is currently being logged.
- */
- @Override
- public abstract boolean isLoggable(Level level);
-
- /**
- * Logs a {@link Level#SEVERE SEVERE} message.
- *
- * @param message the message to log.
- */
- @Override
- public abstract void severe(String message);
-
- /**
- * Logs a {@link Level#WARNING WARNING} message.
- *
- * @param message the message to log.
- */
- @Override
- public abstract void warning(String message);
-
- /**
- * Logs an {@link Level#INFO INFO} message.
- *
- * @param message the message to log.
- */
- @Override
- public abstract void info(String message);
-
- /**
- * Logs an {@link Level#CONFIG CONFIG} message.
- *
- * @param message the message to log.
- */
- @Override
- public abstract void config(String message);
-
- /**
- * Logs a {@link Level#FINE FINE} message.
- *
- * @param message the message to log.
- */
- @Override
- public abstract void fine(String message);
-
- /**
- * Logs a {@link Level#FINER FINER} message.
- *
- * @param message the message to log.
- */
- @Override
- public abstract void finer(String message);
-
- /**
- * Logs a {@link Level#FINEST FINEST} message.
- *
- * @param message the message to log.
- */
- @Override
- public abstract void finest(String message);
-
- /**
- * Logs a method entry to the {@linkplain #getDebugLevel debug level}. Compared to the
- * default {@link Logger}, this implementation bypass the level check in order to let
- * the backing logging framework do its own check.
- *
- * @param sourceClass name of class that issued the logging request.
- * @param sourceMethod name of method that is being entered.
- */
- @Override
- public void entering(final String sourceClass, final String sourceMethod) {
- logp(getDebugLevel(), sourceClass, sourceMethod, "ENTRY");
- }
-
- /**
- * Logs a method entry to the {@linkplain #getDebugLevel debug level} with one parameter.
- * Compared to the default {@link Logger}, this implementation bypass the level check in
- * order to let the backing logging framework do its own check.
- *
- * @param sourceClass name of class that issued the logging request.
- * @param sourceMethod name of method that is being entered.
- * @param param parameter to the method being entered.
- */
- @Override
- public void entering(String sourceClass, String sourceMethod, Object param) {
- logp(getDebugLevel(), sourceClass, sourceMethod, "ENTRY {0}", param);
- }
-
- /**
- * Logs a method entry to the {@linkplain #getDebugLevel debug level} with many parameters.
- * Compared to the default {@link Logger}, this implementation bypass the level check in
- * order to let the backing logging framework do its own check.
- *
- * @param sourceClass name of class that issued the logging request.
- * @param sourceMethod name of method that is being entered.
- * @param params array of parameters to the method being entered.
- */
- @Override
- public void entering(final String sourceClass, final String sourceMethod, final Object[] params) {
- final String message;
- if (params == null) {
- message = "ENTRY";
- } else switch (params.length) {
- case 0: message = "ENTRY"; break;
- case 1: message = "ENTRY {0}"; break;
- case 2: message = "ENTRY {0} {1}"; break;
- default: {
- final StringBuilder builder = new StringBuilder("ENTRY");
- for (int i=0; i<params.length; i++) {
- builder.append(" {").append(i).append('}');
- }
- message = builder.toString();
- break;
- }
- }
- logp(getDebugLevel(), sourceClass, sourceMethod, message, params);
- }
-
- /**
- * Logs a method return to the {@linkplain #getDebugLevel debug level}. Compared to the
- * default {@link Logger}, this implementation bypass the level check in order to let
- * the backing logging framework do its own check.
- *
- * @param sourceClass name of class that issued the logging request.
- * @param sourceMethod name of the method.
- */
- @Override
- public void exiting(final String sourceClass, final String sourceMethod) {
- logp(getDebugLevel(), sourceClass, sourceMethod, "RETURN");
- }
-
- /**
- * Logs a method return to the {@linkplain #getDebugLevel debug level}. Compared to the
- * default {@link Logger}, this implementation bypass the level check in order to let
- * the backing logging framework do its own check.
- *
- * @param sourceClass name of class that issued the logging request.
- * @param sourceMethod name of the method.
- * @param result object that is being returned.
- */
- @Override
- public void exiting(String sourceClass, String sourceMethod, Object result) {
- logp(getDebugLevel(), sourceClass, sourceMethod, "RETURN {0}", result);
- }
-
- /**
- * Logs a method failure to the {@linkplain #getDebugLevel debug level}. Compared to the
- * default {@link Logger}, this implementation bypass the level check in order to let
- * the backing logging framework do its own check.
- *
- * @param sourceClass name of class that issued the logging request.
- * @param sourceMethod name of the method.
- * @param thrown the Throwable that is being thrown.
- */
- @Override
- public void throwing(String sourceClass, String sourceMethod, Throwable thrown) {
- logp(getDebugLevel(), sourceClass, sourceMethod, "THROW", thrown);
- }
-
- /**
- * Logs a record. The default implementation delegates to one of the
- * {@link #logrb(Level,String,String,ResourceBundle,String,Object[]) logrb} or
- * {@link #logp(Level,String,String,String)} methods.
- *
- * @param record the log record to be published.
- */
- @Override
- public void log(final LogRecord record) {
- /*
- * The filter should always be null since we overrode the 'setFilter' method as a no-op.
- * But we check it anyway as matter of principle just in case some subclass overrides the
- * 'getFilter()' method. This is the only method where we can do this check cheaply. Note
- * that this is NOT the check for logging level; Filters are for user-specified criteria.
- */
- final Filter filter = getFilter();
- if (filter != null && !filter.isLoggable(record)) {
- return;
- }
- final Level level = record.getLevel();
- final String sourceClass = record.getSourceClassName();
- final String sourceMethod = record.getSourceMethodName();
- final String message = record.getMessage();
- final Object[] params = record.getParameters();
- final Throwable thrown = record.getThrown();
- final ResourceBundle bundle = record.getResourceBundle();
- final boolean useThrown = (thrown != null) && (params == null || params.length == 0);
- if (bundle != null) {
- if (useThrown) {
- logrb(level, sourceClass, sourceMethod, bundle, message, thrown);
- } else {
- logrb(level, sourceClass, sourceMethod, bundle, message, params);
- }
- } else {
- final String bundleName = record.getResourceBundleName();
- if (bundleName != null) {
- if (useThrown) {
- logrb(level, sourceClass, sourceMethod, bundleName, message, thrown);
- } else {
- logrb(level, sourceClass, sourceMethod, bundleName, message, params);
- }
- } else {
- if (useThrown) {
- logp(level, sourceClass, sourceMethod, message, thrown);
- } else {
- logp(level, sourceClass, sourceMethod, message, params);
- }
- }
- }
- }
-
- /**
- * Logs a record at the specified level. The default implementation delegates to one of the
- * {@link #severe(String) severe}, {@link #warning(String) warning}, {@link #info(String) info},
- * {@link #config(String) config}, {@link #fine(String) fine}, {@link #finer(String) finer} or
- * {@link #finest(String) finest} methods according the supplied level.
- *
- * @param level one of the message level identifiers.
- * @param message the message to log.
- */
- @Override
- @SuppressWarnings("fallthrough")
- public void log(final Level level, final String message) {
- final int n = level.intValue();
- switch (n / 100) {
- default: {
- if (n < 0 || n == Integer.MAX_VALUE) break;
- /*
- * MAX_VALUE is a special value for Level.OFF. Otherwise and
- * if positive, fallthrough since we are greater than SEVERE.
- */
- }
- case 10: severe (message); break;
- case 9: warning(message); break;
- case 8: info (message); break;
- case 7: config (message); break;
- case 6:
- case 5: fine (message); break;
- case 4: finer (message); break;
- case 3: finest (message); break;
- case 2: /* Logging OFF */
- case 1: /* Logging OFF */
- case 0: /* Logging OFF */ break;
- }
- }
-
- /**
- * Logs a record at the specified level. The default implementation discards the exception
- * and delegates to <code>{@linkplain #log(Level,String) log}(level, message)</code>.
- *
- * @param level one of the message level identifiers.
- * @param message the message to log.
- * @param thrown throwable associated with log message.
- */
- @Override
- public void log(final Level level, final String message, final Throwable thrown) {
- log(level, message);
- }
-
- /**
- * Logs a record at the specified level. The default implementation delegates to
- * <code>{@linkplain #log(Level,String,Object[]) log}(level, message, params)</code>
- * where the {@code params} array is built from the {@code param} object.
- *
- * @param level one of the message level identifiers.
- * @param message the message to log.
- * @param param parameter to the method being entered.
- */
- @Override
- public void log(final Level level, final String message, final Object param) {
- log(level, message, asArray(param));
- }
-
- /**
- * Logs a record at the specified level.
- * The default implementation formats the message immediately, then delegates to
- * <code>{@linkplain #log(Level,String) log}(level, message)</code>.
- *
- * @param level one of the message level identifiers.
- * @param message the message to log.
- * @param params array of parameters to the method being entered.
- */
- @Override
- public void log(final Level level, final String message, final Object[] params) {
- log(level, format(message, params));
- }
-
- /**
- * Logs a record at the specified level. The default implementation discards
- * the source class and source method, then delegates to
- * <code>{@linkplain #log(Level,String) log}(level, message)</code>.
- *
- * @param level one of the message level identifiers.
- * @param sourceClass name of class that issued the logging request.
- * @param sourceMethod name of the method.
- * @param message the message to log.
- */
- @Override
- public void logp(final Level level, final String sourceClass, final String sourceMethod,
- final String message)
- {
- log(level, message);
- }
-
- /**
- * Logs a record at the specified level. The default implementation discards
- * the source class and source method, then delegates to
- * <code>{@linkplain #log(Level,String,Throwable) log}(level, message, thrown)</code>.
- *
- * @param level one of the message level identifiers.
- * @param sourceClass name of class that issued the logging request.
- * @param sourceMethod name of the method.
- * @param message the message to log.
- * @param thrown throwable associated with log message.
- */
- @Override
- public void logp(final Level level, final String sourceClass, final String sourceMethod,
- final String message, final Throwable thrown)
- {
- log(level, message, thrown);
- }
-
- /**
- * Logs a record at the specified level. The default implementation delegates to
- * <code>{@linkplain #logp(Level,String,String,String,Object[]) logp}(level, sourceClass,
- * sourceMethod, message, params)</code> where the {@code params} array is built from the
- * {@code param} object.
- *
- * <p>Note that {@code sourceClass} and {@code sourceMethod} will be discarded unless the
- * target {@link #logp(Level,String,String,String) logp} method has been overridden.</p>
- *
- * @param level one of the message level identifiers.
- * @param sourceClass name of class that issued the logging request.
- * @param sourceMethod name of the method.
- * @param message the message to log.
- * @param param parameter to the method being entered.
- */
- @Override
- public void logp(final Level level, final String sourceClass, final String sourceMethod,
- final String message, final Object param)
- {
- logp(level, sourceClass, sourceMethod, message, asArray(param));
- }
-
- /**
- * Logs a record at the specified level. The default implementation formats the message
- * immediately, then delegates to <code>{@linkplain #logp(Level,String,String,String)
- * logp}(level, sourceClass, sourceMethod, message)</code>.
- *
- * <p>Note that {@code sourceClass} and {@code sourceMethod} will be discarded unless the
- * target {@link #logp(Level,String,String,String) logp} method has been overridden.</p>
- *
- * @param level one of the message level identifiers.
- * @param sourceClass name of class that issued the logging request.
- * @param sourceMethod name of the method.
- * @param message the message to log.
- * @param params array of parameters to the method being entered.
- */
- @Override
- public void logp(final Level level, final String sourceClass, final String sourceMethod,
- final String message, final Object[] params)
- {
- logp(level, sourceClass, sourceMethod, format(message, params));
- }
-
- /**
- * Logs a localizable record at the specified level. The default implementation localizes the
- * message immediately, then delegates to <code>{@linkplain #logp(Level,String,String,String,
- * Object[]) logp}(level, sourceClass, sourceMethod, message, params)</code>.
- *
- * @param level one of the message level identifiers.
- * @param sourceClass name of class that issued the logging request.
- * @param sourceMethod name of the method.
- * @param bundle the resource bundle for localizing the message, or {@code null}.
- * @param message the message to log.
- * @param params array of parameters to the method being entered.
- *
- * @since 0.5
- */
- @Override
- public void logrb(final Level level, final String sourceClass, final String sourceMethod,
- final ResourceBundle bundle, final String message, final Object... params)
- {
- logp(level, sourceClass, sourceMethod, localize(bundle, message), params);
- }
-
- /**
- * Logs a localizable record at the specified level. The default implementation localizes the
- * message immediately, then delegates to <code>{@linkplain #logp(Level,String,String,String,
- * Throwable) logp}(level, sourceClass, sourceMethod, message, thrown)</code>.
- *
- * @param level one of the message level identifiers.
- * @param sourceClass name of class that issued the logging request.
- * @param sourceMethod name of the method.
- * @param bundle the resource bundle for localizing the message, or {@code null}.
- * @param message the message to log.
- * @param thrown throwable associated with log message.
- *
- * @since 0.5
- */
- @Override
- public void logrb(final Level level, final String sourceClass, final String sourceMethod,
- final ResourceBundle bundle, final String message, final Throwable thrown)
- {
- logp(level, sourceClass, sourceMethod, localize(bundle, message), thrown);
- }
-
- /**
- * Logs a localizable record at the specified level. The default implementation localizes the
- * message immediately, then delegates to <code>{@linkplain #logp(Level,String,String,String)
- * logp}(level, sourceClass, sourceMethod, message)</code>.
- *
- * @param level one of the message level identifiers.
- * @param sourceClass name of class that issued the logging request.
- * @param sourceMethod name of the method.
- * @param bundleName name of resource bundle to localize message, or {@code null}.
- * @param message the message to log.
- *
- * @deprecated JDK 8 has deprecated this method.
- */
- @Override
- @Deprecated
- public void logrb(final Level level, final String sourceClass, final String sourceMethod,
- final String bundleName, final String message)
- {
- logp(level, sourceClass, sourceMethod, localize(bundleName, message));
- }
-
- /**
- * Logs a localizable record at the specified level. The default implementation localizes the
- * message immediately, then delegates to <code>{@linkplain #logp(Level,String,String,String,
- * Throwable) logp}(level, sourceClass, sourceMethod, message, thrown)</code>.
- *
- * @param level one of the message level identifiers.
- * @param sourceClass name of class that issued the logging request.
- * @param sourceMethod name of the method.
- * @param bundleName name of resource bundle to localize message, or {@code null}.
- * @param message the message to log.
- * @param thrown throwable associated with log message.
- *
- * @deprecated JDK 8 has deprecated this method.
- */
- @Override
- @Deprecated
- public void logrb(final Level level, final String sourceClass, final String sourceMethod,
- final String bundleName, final String message, final Throwable thrown)
- {
- logp(level, sourceClass, sourceMethod, localize(bundleName, message), thrown);
- }
-
- /**
- * Logs a localizable record at the specified level. The default implementation localizes the
- * message immediately, then delegates to <code>{@linkplain #logp(Level,String,String,String,
- * Object) logp}(level, sourceClass, sourceMethod, message, param)</code>.
- *
- * @param level one of the message level identifiers.
- * @param sourceClass name of class that issued the logging request.
- * @param sourceMethod name of the method.
- * @param bundleName name of resource bundle to localize message, or {@code null}.
- * @param message the message to log.
- * @param param parameter to the method being entered.
- *
- * @deprecated JDK 8 has deprecated this method.
- */
- @Override
- @Deprecated
- public void logrb(final Level level, final String sourceClass, final String sourceMethod,
- final String bundleName, final String message, final Object param)
- {
- logp(level, sourceClass, sourceMethod, localize(bundleName, message), param);
- }
-
- /**
- * Logs a localizable record at the specified level. The default implementation localizes the
- * message immediately, then delegates to <code>{@linkplain #logp(Level,String,String,String,
- * Object[]) logp}(level, sourceClass, sourceMethod, message, params)</code>.
- *
- * @param level one of the message level identifiers.
- * @param sourceClass name of class that issued the logging request.
- * @param sourceMethod name of the method.
- * @param bundleName name of resource bundle to localize message, or {@code null}.
- * @param message the message to log.
- * @param params array of parameters to the method being entered.
- *
- * @deprecated JDK 8 has deprecated this method.
- */
- @Override
- @Deprecated
- public void logrb(final Level level, final String sourceClass, final String sourceMethod,
- final String bundleName, final String message, final Object[] params)
- {
- logp(level, sourceClass, sourceMethod, localize(bundleName, message), params);
- }
-
- /**
- * Do nothing since this logger adapter does not supports handlers.
- * The configuration should be fully controlled by the external logging framework
- * (e.g. <a href="http://commons.apache.org/logging/">Commons-logging</a>) instead,
- * which is not expected to use {@link Handler} objects.
- *
- * @param handler a logging handler, ignored in default implementation.
- */
- @Override
- public void addHandler(Handler handler) {
- }
-
- /**
- * Do nothing since this logger adapter does not support handlers.
- *
- * @param handler a logging handler, ignored in default implementation.
- */
- @Override
- public void removeHandler(Handler handler) {
- }
-
- /**
- * Do nothing since this logger never use parent handlers. This is consistent
- * with {@link #addHandler} not allowing to add any handlers, and avoid mixing
- * loggings from the external framework with JDK loggings.
- *
- * @param useParentHandlers ignored in default implementation.
- */
- @Override
- public void setUseParentHandlers(boolean useParentHandlers) {
- }
-
- /**
- * Do nothing since this logger adapter does not support arbitrary parents.
- * More specifically, it should not inherits any configuration from a parent
- * logger using the JDK logging framework.
- *
- * @param parent ignored in default implementation.
- */
- @Override
- public void setParent(Logger parent) {
- }
-
- /**
- * Do nothing since this logger adapter does not support filters. It is difficult to query
- * efficiently the filter in this {@code LoggerAdapter} architecture (e.g. we would need to
- * make sure that {@link Filter#isLoggable} is invoked only once even if a {@code log} call
- * is cascaded into many other {@code log} calls, and this test must works in multi-threads
- * environment).
- *
- * @param filter ignored in default implementation.
- */
- @Override
- public void setFilter(Filter filter) {
- }
-
- /**
- * Wraps the specified object in an array. This is a helper method for
- * {@code log(…, Object)} methods that delegate their work to {@code log(…, Object[])}
- */
- private static Object[] asArray(final Object param) {
- return (param != null) ? new Object[] {param} : null;
- }
-
- /**
- * Formats the specified message. This is a helper method for
- * {@code log(…, Object[])} methods that delegate their work to {@code log(…)}
- */
- private static String format(String message, final Object[] params) {
- if (params != null && params.length != 0) {
- if (MESSAGE_FORMAT.matcher(message).find()) try {
- message = MessageFormat.format(message, params);
- } catch (IllegalArgumentException e) {
- /*
- * The default Formatter.messageFormat implementation ignores this exception
- * and uses the pattern as the message, so we mimic its behavior here.
- */
- }
- }
- return message;
- }
-
- /**
- * Localizes the specified message. This is a helper method for
- * {@code logrb(…)} methods that delegate their work to {@code logp(…)}
- */
- private static String localize(final String bundleName, String message) {
- if (bundleName != null) try {
- message = ResourceBundle.getBundle(bundleName).getString(message);
- } catch (MissingResourceException e) {
- /*
- * The default Formatter.messageFormat implementation ignores this exception
- * and uses the bundle key as the message, so we mimic its behavior here.
- */
- }
- return message;
- }
-
- /**
- * Localizes the specified message. This is a helper method for
- * {@code logrb(…)} methods that delegate their work to {@code logp(…)}
- */
- private static String localize(final ResourceBundle bundle, String message) {
- if (bundle != null) try {
- message = bundle.getString(message);
- } catch (MissingResourceException e) {
- /*
- * The default Formatter.messageFormat implementation ignores this exception
- * and uses the bundle key as the message, so we mimic its behavior here.
- */
- }
- return message;
- }
-}
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/logging/LoggerFactory.java b/core/sis-utility/src/main/java/org/apache/sis/util/logging/LoggerFactory.java
deleted file mode 100644
index fcb43b9614..0000000000
--- a/core/sis-utility/src/main/java/org/apache/sis/util/logging/LoggerFactory.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * 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.sis.util.logging;
-
-import java.util.logging.Logger;
-import org.apache.sis.util.collection.WeakValueHashMap;
-
-
-/**
- * A factory for Java {@link Logger} wrapping an other logging framework.
- * This factory is used only when an application wants to redirect SIS logs to an other framework
- * than JDK logging. An instance of {@code LoggerFactory} can be registered to SIS in two ways:
- *
- * <ul>
- * <li>By declaring the fully qualified classname of the {@code LoggerFactory} implementation
- * in the {@code META-INF/services/org.apache.sis.util.logging.LoggerFactory} file.
- * Note that the {@code sis-logging-commons.jar} and {@code sis-logging-log4j.jar}
- * files provide such declaration.</li>
- * <li>By explicit invocation of {@link Logging#setLoggerFactory(LoggerFactory)}
- * at application initialization time.</li>
- * </ul>
- *
- * The {@link #getLogger(String)} method shall return some {@link Logger} subclass
- * (typically {@link LoggerAdapter}) which forwards directly all log methods to the other framework.
- *
- * <h2>Thread safety</h2>
- * This base class is safe for multi-threads usage. Subclasses registered in {@code META-INF/services/}
- * shall make sure that any overridden methods remain safe to call from multiple threads.
- *
- * @author Martin Desruisseaux (IRD, Geomatys)
- * @version 0.3
- *
- * @param <L> the type of loggers used for the implementation backend.
- * This is the type used by external frameworks like Log4J.
- *
- * @see Logging
- * @see LoggerAdapter
- *
- * @since 0.3
- * @module
- *
- * @deprecated Will be removed since there is now other mechanisms for redirecting logging.
- * See <a href="https://issues.apache.org/jira/browse/SIS-531">SIS-531</a>.
- */
-@Deprecated
-public abstract class LoggerFactory<L> {
- /**
- * The logger class. We ask for this information right at construction time in order to
- * force a {@link NoClassDefFoundError} early rather than only the first time a message
- * is logged.
- */
- private final Class<L> loggerClass;
-
- /**
- * The loggers created up to date.
- */
- private final WeakValueHashMap<String,Logger> loggers;
-
- /**
- * Creates a new factory.
- *
- * @param loggerClass The class of the wrapped logger.
- */
- protected LoggerFactory(final Class<L> loggerClass) {
- this.loggerClass = loggerClass;
- loggers = new WeakValueHashMap<>(String.class);
- }
-
- /**
- * Returns the name of the logging framework.
- *
- * @return the logging framework name.
- */
- public abstract String getName();
-
- /**
- * Returns the logger of the specified name, or {@code null} if the JDK logging framework
- * should be used.
- *
- * @param name the name of the logger.
- * @return the logger, or {@code null} if the JDK logging framework should be used.
- */
- public Logger getLogger(final String name) {
- final L target = getImplementation(name);
- if (target == null) {
- return null;
- }
- synchronized (loggers) {
- Logger logger = loggers.get(name);
- if (logger == null || !target.equals(unwrap(logger))) {
- logger = wrap(name, target);
- loggers.put(name, logger);
- }
- return logger;
- }
- }
-
- /**
- * Returns the base class of objects to be returned by {@link #getImplementation(String)}.
- * The class depends on the underlying logging framework (Log4J, SLF4J, <i>etc.</i>).
- *
- * @return the type of loggers used for the implementation backend.
- */
- public Class<L> getImplementationClass() {
- return loggerClass;
- }
-
- /**
- * Returns the implementation to use for the logger of the specified name. The object to be
- * returned depends on the logging framework (Log4J, SLF4J, <i>etc.</i>). If the target
- * framework redirects logging events to JDK logging, then this method shall return
- * {@code null} since we should not use wrapper at all.
- *
- * @param name the name of the logger.
- * @return the logger as an object of the target logging framework (Log4J, SLF4J,
- * <i>etc.</i>), or {@code null} if the target framework would redirect
- * to the JDK logging framework.
- */
- protected abstract L getImplementation(String name);
-
- /**
- * Wraps the specified {@linkplain #getImplementation(String) implementation} in a JDK logger.
- *
- * @param name the name of the logger.
- * @param implementation an implementation returned by {@link #getImplementation(String)}.
- * @return a new logger wrapping the specified implementation.
- */
- protected abstract Logger wrap(String name, L implementation);
-
- /**
- * Returns the {@linkplain #getImplementation(String) implementation} wrapped by the specified
- * logger, or {@code null} if none. If the specified logger is not an instance of the expected
- * class, then this method should returns {@code null}.
- *
- * @param logger the logger to test.
- * @return the implementation wrapped by the specified logger, or {@code null} if none.
- */
- protected abstract L unwrap(Logger logger);
-}
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java b/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java
index 014e41a5a9..d578f0072a 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/logging/Logging.java
@@ -16,13 +16,11 @@
*/
package org.apache.sis.util.logging;
-import java.util.ServiceLoader;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.LogRecord;
import org.apache.sis.util.ArgumentChecks;
-import org.apache.sis.util.Configuration;
import org.apache.sis.util.Static;
import org.apache.sis.util.Exceptions;
import org.apache.sis.util.Classes;
@@ -31,14 +29,8 @@ import org.apache.sis.internal.system.Modules;
/**
- * A set of utilities method for configuring loggings in SIS. Library implementers should fetch
- * their loggers using the {@link #getLogger(String)} static method defined in this {@code Logging}
- * class rather than the one defined in the standard {@link Logger} class, in order to give SIS a
- * chance to redirect the logs to an other framework like
- * <a href="http://commons.apache.org/logging/">Commons-logging</a> or
- * <a href="http://logging.apache.org/log4j">Log4J</a>.
- *
- * <p>This class provides also some convenience static methods, including:</p>
+ * A set of utilities method for configuring loggings in SIS.
+ * This class provides also some convenience static methods, including:
* <ul>
* <li>{@link #log(Class, String, LogRecord)} for {@linkplain LogRecord#setLoggerName(String) setting
* the logger name}, {@linkplain LogRecord#setSourceClassName(String) source class name} and
@@ -49,7 +41,7 @@ import org.apache.sis.internal.system.Modules;
* </ul>
*
* @author Martin Desruisseaux (Geomatys)
- * @version 1.1
+ * @version 1.3
* @since 0.3
* @module
*/
@@ -66,112 +58,15 @@ public final class Logging extends Static {
*/
private static final int LEVEL_THRESHOLD_FOR_STACKTRACE = 600;
- /**
- * The factory for obtaining {@link Logger} instances, or {@code null} if none.
- * If {@code null} (the default), then the standard JDK logging framework will be used.
- * {@code Logging} scans the classpath for logger factories on class initialization.
- * The fully qualified factory classname shall be declared in the following file:
- *
- * {@preformat text
- * META-INF/services/org.apache.sis.util.logging.LoggerFactory
- * }
- *
- * The factory found on the classpath is assigned to the {@link #factory} field. If more than one factory
- * is found, then the log messages will be sent to the logging frameworks managed by all those factories.
- *
- * <div class="note"><b>API note:</b>
- * A previous version was providing a {@code scanForPlugins()} method allowing developers to refresh the
- * object state when new {@link LoggerFactory} instances become available on the classpath of a running JVM.
- * However it usually doesn't work since loggers are typically stored in static final fields.</div>
- *
- * @see #setLoggerFactory(LoggerFactory)
- */
- private static volatile LoggerFactory<?> factory;
- static {
- /*
- * Use ServiceLoader.load(…), not DefaultFactories.createServiceLoader(…), for avoiding a never-ending
- * loop if a warning occurs in DefaultFactories. This risk exists because DefaultFactories may use the
- * logging services. Anyway, Apache SIS does not define any custom logger factory, so DefaultFactories
- * is not needed in this case.
- */
- LoggerFactory<?> factory = null;
- for (final LoggerFactory<?> found : ServiceLoader.load(LoggerFactory.class)) {
- if (factory == null) {
- factory = found;
- } else {
- factory = new DualLoggerFactory(factory, found);
- }
- }
- Logging.factory = factory;
- }
-
/**
* Do not allow instantiation of this class.
*/
private Logging() {
}
- /**
- * Sets a new factory to use for obtaining {@link Logger} instances.
- * If the given {@code factory} argument is {@code null} (the default),
- * then the standard Logging framework will be used.
- *
- * <h4>Limitation</h4>
- * SIS classes typically declare a logger constant like below:
- *
- * {@preformat java
- * public static final Logger LOGGER = Logging.getLogger("the.logger.name");
- * }
- *
- * Factory changes will take effect only if this method is invoked before the initialization
- * of such classes.
- *
- * @param factory the new logger factory, or {@code null} if none.
- */
- @Configuration
- public static void setLoggerFactory(final LoggerFactory<?> factory) {
- Logging.factory = factory;
- }
-
- /**
- * Returns the factory used for obtaining {@link Logger} instances, or {@code null} if none.
- *
- * @return the current logger factory, or {@code null} if none.
- */
- public static LoggerFactory<?> getLoggerFactory() {
- return factory;
- }
-
- /**
- * Returns a logger for the specified name. If a {@linkplain LoggerFactory logger factory} has been set,
- * then this method first {@linkplain LoggerFactory#getLogger(String) asks to the factory}.
- * This rule gives SIS a chance to redirect logging events to
- * <a href="http://commons.apache.org/logging/">commons-logging</a> or some equivalent framework.
- * Only if no factory was found or if the factory choose to not redirect the loggings, then this
- * method delegate to <code>{@linkplain Logger#getLogger(String) Logger.getLogger}(name)</code>.
- *
- * @param name the logger name.
- * @return a logger for the specified name.
- *
- * @deprecated Use the standard {@link Logger#getLogger(String)} method instead.
- * See <a href="https://issues.apache.org/jira/browse/SIS-531">SIS-531</a>.
- */
- @Deprecated
- public static Logger getLogger(final String name) {
- ArgumentChecks.ensureNonNull("name", name);
- final LoggerFactory<?> factory = Logging.factory;
- if (factory != null) {
- final Logger logger = factory.getLogger(name);
- if (logger != null) {
- return logger;
- }
- }
- return Logger.getLogger(name);
- }
-
/**
* Returns a logger for the package of the specified class. This convenience method invokes
- * {@link #getLogger(String)} with the package name of the given class taken as the logger name.
+ * {@link Logger#getLogger(String)} with the package name of the given class taken as the logger name.
*
* @param source the class which will emit a logging message.
* @return a logger for the specified class.
@@ -185,7 +80,7 @@ public final class Logging extends Static {
// Remove the "internal" part from Apache SIS package names.
name = Modules.CLASSNAME_PREFIX + name.substring(Modules.INTERNAL_CLASSNAME_PREFIX.length());
}
- return getLogger(name);
+ return Logger.getLogger(name);
}
/**
@@ -216,7 +111,7 @@ public final class Logging extends Static {
logger = getLogger(classe);
record.setLoggerName(logger.getName());
} else {
- logger = getLogger(loggerName);
+ logger = Logger.getLogger(loggerName);
}
if (classe != null && method != null) {
record.setSourceClassName(classe.getCanonicalName());
@@ -276,7 +171,7 @@ public final class Logging extends Static {
*/
if (logger == null) {
final int separator = classname.lastIndexOf('.');
- logger = getLogger((separator >= 1) ? classname.substring(0, separator-1) : "");
+ logger = Logger.getLogger((separator >= 1) ? classname.substring(0, separator-1) : "");
}
if (classe == null) {
classe = classname;
@@ -291,7 +186,7 @@ public final class Logging extends Static {
* Fallback on the global logger.
*/
if (logger == null) {
- logger = getLogger(Logger.GLOBAL_LOGGER_NAME);
+ logger = Logger.getLogger(Logger.GLOBAL_LOGGER_NAME);
}
if (classe != null) {
record.setSourceClassName(classe);
@@ -392,7 +287,7 @@ public final class Logging extends Static {
if (logger == null && classe != null) {
final int separator = classe.lastIndexOf('.');
final String paquet = (separator >= 1) ? classe.substring(0, separator-1) : "";
- logger = getLogger(paquet);
+ logger = Logger.getLogger(paquet);
}
if (logger != null && !logger.isLoggable(level)) {
return false;
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java b/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java
index 89c2d7b036..4966b0188d 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/logging/MonolineFormatter.java
@@ -327,12 +327,12 @@ public class MonolineFormatter extends Formatter {
try {
timeFormat(manager.getProperty(classname + ".time"));
} catch (IllegalArgumentException exception) {
- Logging.configurationException(Logging.getLogger(Modules.UTILITIES), MonolineFormatter.class, "<init>", exception);
+ Logging.configurationException(Logger.getLogger(Modules.UTILITIES), MonolineFormatter.class, "<init>", exception);
}
try {
sourceFormat(manager.getProperty(classname + ".source"));
} catch (IllegalArgumentException exception) {
- Logging.configurationException(Logging.getLogger(Modules.UTILITIES), MonolineFormatter.class, "<init>", exception);
+ Logging.configurationException(Logger.getLogger(Modules.UTILITIES), MonolineFormatter.class, "<init>", exception);
}
/*
* Applies the default set of colors only if the handler is writing to the console.
@@ -981,7 +981,7 @@ loop: for (int i=0; ; i++) {
*/
@Configuration
public static MonolineFormatter install() throws SecurityException {
- return install(Logging.getLogger(""), null);
+ return install(Logger.getLogger(""), null);
}
/**
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/logging/package-info.java b/core/sis-utility/src/main/java/org/apache/sis/util/logging/package-info.java
index 5838f8aab8..5991714914 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/logging/package-info.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/logging/package-info.java
@@ -20,9 +20,7 @@
* This package provides:
*
* <ul>
- * <li>A {@link org.apache.sis.util.logging.Logging} utility class with static methods for
- * fetching a logger (see <cite>Choosing a logging framework</cite> below) or logging an
- * exception.</li>
+ * <li>A {@link org.apache.sis.util.logging.Logging} utility class with static utility methods.</li>
* <li>A {@link org.apache.sis.util.logging.PerformanceLevel} with configurable levels for
* logging the duration of lengthly processes.</li>
* <li>A {@link org.apache.sis.util.logging.MonolineFormatter} for formatting the log
@@ -30,29 +28,16 @@
* </ul>
*
* <h2>Choosing a logging framework</h2>
- * The SIS project uses the standard {@link java.util.logging.Logger} API for its logging,
- * but this package allows redirection of logging messages to some other frameworks like
- * <a href="http://logging.apache.org/log4j/">Log4J</a>.
- * We recommend to stick to standard JDK logging when possible. However if inter-operability
- * with an other logging framework is required, then the only action needed is to include
- * <strong>one</strong> of the following JAR on the classpath:
- *
- * <ul>
- * <li>{@code sis-logging-commons.jar} for Apache logging</li>
- * <li>{@code sis-logging-log4j.jar} for Log4J logging</li>
- * <li>Any other JAR registering a {@link org.apache.sis.util.logging.LoggerFactory} implementation.</li>
- * </ul>
- *
- * <h2>Note for SIS developers</h2>
- * All SIS code should fetch their logger through a call to our custom
- * {@link org.apache.sis.util.logging.Logging#getLogger(String)} method instead of
- * the standard {@link java.util.logging.Logger#getLogger(String)} method. This is necessary in
- * order to give SIS a chance to redirect log events to an other logging framework.
+ * The SIS project uses the standard {@link java.util.logging.Logger} API for its logging.
+ * It does not mean that users of the SIS library are forced to use that logging framework.
+ * Java logging can be used as an API more powerful than {@link java.lang.System.Logger}
+ * and other frameworks can redirect Java logging to themselves. For example adding the
+ * {@code jul-to-slf4j.jar} dependency to a project is sufficient for redirecting Java logging to SLF4J.
*
* @author Martin Desruisseaux (Geomatys)
- * @version 1.2
+ * @version 1.3
*
- * @see <a href="http://download.oracle.com/javase/6/docs/technotes/guides/logging/overview.html">Java Logging Overview</a>
+ * @see <a href="https://docs.oracle.com/en/java/javase/18/core/java-logging-overview.html">Java Logging Overview</a>
*
* @since 0.3
* @module
diff --git a/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java b/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
index 1ee9265a57..0a593eed82 100644
--- a/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
+++ b/core/sis-utility/src/main/java/org/apache/sis/util/resources/IndexedResourceBundle.java
@@ -48,6 +48,8 @@ import org.apache.sis.internal.util.Strings;
import org.apache.sis.measure.RangeFormat;
import org.apache.sis.measure.Range;
+import static java.util.logging.Logger.getLogger;
+
/**
* {@link ResourceBundle} implementation accepting integers instead of strings for resource keys.
@@ -373,7 +375,7 @@ public class IndexedResourceBundle extends ResourceBundle implements Localized {
keyID = getKeyConstants().getKeyValue(key);
} catch (ReflectiveOperationException e) {
e.addSuppressed(exception);
- Logging.recoverableException(Logging.getLogger(Loggers.LOCALIZATION), getClass(), "handleGetObject", e);
+ Logging.recoverableException(getLogger(Loggers.LOCALIZATION), getClass(), "handleGetObject", e);
return null; // This is okay as of 'handleGetObject' contract.
}
}
diff --git a/core/sis-utility/src/test/java/org/apache/sis/test/LoggingWatcher.java b/core/sis-utility/src/test/java/org/apache/sis/test/LoggingWatcher.java
index 21180fe1d5..0ed8601674 100644
--- a/core/sis-utility/src/test/java/org/apache/sis/test/LoggingWatcher.java
+++ b/core/sis-utility/src/test/java/org/apache/sis/test/LoggingWatcher.java
@@ -36,7 +36,7 @@ import static org.junit.Assert.*;
*
* {@preformat java
* @Rule
- * public final LoggingWatcher loggings = new LoggingWatcher(Logging.getLogger(Loggers.XML));
+ * public final LoggingWatcher loggings = new LoggingWatcher(Logger.getLogger(Loggers.XML));
* }
*
* Recommended but not mandatory, ensure that there is no unexpected logging in any tests:
diff --git a/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java b/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
index 7069720f4c..4e81d87f86 100644
--- a/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
+++ b/core/sis-utility/src/test/java/org/apache/sis/test/suite/UtilityTestSuite.java
@@ -53,7 +53,6 @@ import org.junit.BeforeClass;
org.apache.sis.util.ArgumentChecksTest.class, // Uses resources.
org.apache.sis.util.logging.PerformanceLevelTest.class,
org.apache.sis.util.logging.MonolineFormatterTest.class,
- org.apache.sis.util.logging.LoggerAdapterTest.class,
org.apache.sis.math.FractionTest.class,
org.apache.sis.math.VectorTest.class,
org.apache.sis.math.RepeatedVectorTest.class,
diff --git a/core/sis-utility/src/test/java/org/apache/sis/util/logging/DummyLogger.java b/core/sis-utility/src/test/java/org/apache/sis/util/logging/DummyLogger.java
deleted file mode 100644
index 2f26514add..0000000000
--- a/core/sis-utility/src/test/java/org/apache/sis/util/logging/DummyLogger.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.sis.util.logging;
-
-import java.util.logging.Level;
-
-
-/**
- * A dummy implementation of {@link LoggerAdapter} class for testing purpose.
- * This class is used by {@link LoggerAdapterTest}.
- *
- * @author Martin Desruisseaux (IRD)
- * @version 0.3
- * @since 0.3
- * @module
- */
-final strictfp class DummyLogger extends LoggerAdapter {
- /**
- * The level of the last logging event.
- */
- Level level;
-
- /**
- * The last logged message.
- */
- String last;
-
- /**
- * Creates a dummy logger.
- */
- DummyLogger() {
- super("org.apache.sis.util.logging");
- clear();
- }
-
- /**
- * Clears the logger state, for testing purpose only.
- */
- public void clear() {
- level = Level.OFF;
- last = null;
- }
-
- @Override
- public void setLevel(Level level) {
- this.level = level;
- }
-
- @Override
- public Level getLevel() {
- return level;
- }
-
- @Override
- public boolean isLoggable(Level level) {
- return level.intValue() > this.level.intValue();
- }
-
- @Override
- public void severe(String message) {
- level = Level.SEVERE;
- last = message;
- }
-
- @Override
- public void warning(String message) {
- level = Level.WARNING;
- last = message;
- }
-
- @Override
- public void info(String message) {
- level = Level.INFO;
- last = message;
- }
-
- @Override
- public void config(String message) {
- level = Level.CONFIG;
- last = message;
- }
-
- @Override
- public void fine(String message) {
- level = Level.FINE;
- last = message;
- }
-
- @Override
- public void finer(String message) {
- level = Level.FINER;
- last = message;
- }
-
- @Override
- public void finest(String message) {
- level = Level.FINEST;
- last = message;
- }
-}
diff --git a/core/sis-utility/src/test/java/org/apache/sis/util/logging/LoggerAdapterTest.java b/core/sis-utility/src/test/java/org/apache/sis/util/logging/LoggerAdapterTest.java
deleted file mode 100644
index d5f0ed6ecb..0000000000
--- a/core/sis-utility/src/test/java/org/apache/sis/util/logging/LoggerAdapterTest.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.sis.util.logging;
-
-import java.util.logging.Level;
-import org.apache.sis.test.TestCase;
-import org.junit.*;
-
-import static org.junit.Assert.*;
-
-
-/**
- * Tests the {@link LoggerAdapter} class.
- *
- * @author Martin Desruisseaux (IRD)
- * @version 0.3
- * @since 0.3
- * @module
- */
-public final strictfp class LoggerAdapterTest extends TestCase {
- /**
- * Tests the {@link LoggerAdapter#log(Level,String)} method.
- * This is of special interest because of the switch cases used in implementation.
- */
- @Test
- public void testLog() {
- final DummyLogger logger = new DummyLogger();
- final Object[] levels = new Object[] {
- Level.FINE, "apple",
- Level.INFO, "orange",
- Level.FINEST, "yellow",
- Level.CONFIG, "yeti",
- Level.SEVERE, "ouch!",
- Level.WARNING, "caution",
- Level.FINEST, "don't mind",
- };
- for (int i=0; i<levels.length; i++) {
- final Level level = (Level) levels[i];
- final String message = (String) levels[++i];
- logger.clear();
- logger.log(level, message);
- assertEquals(level, logger.level);
- assertEquals(message, logger.last);
- }
- /*
- * Actually, Level.OFF has the highest intValue.
- * LoggerAdapter can easily match this level to a no-op.
- */
- logger.clear();
- logger.log(Level.OFF, "off");
- assertEquals(Level.OFF, logger.level);
- /*
- * Actually, Level.ALL has the smallest intValue.
- * LoggerAdapter has no easy match for this level.
- */
- logger.clear();
- logger.log(Level.ALL, "all");
- assertEquals(Level.OFF, logger.level);
- }
-}
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java
index 5cee19c0ac..1c3d25254c 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/Decoder.java
@@ -40,7 +40,6 @@ import org.apache.sis.storage.DataStoreException;
import org.apache.sis.storage.event.StoreListeners;
import org.apache.sis.util.Utilities;
import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.util.logging.Logging;
import org.apache.sis.util.logging.PerformanceLevel;
import org.apache.sis.util.collection.TreeTable;
import org.apache.sis.internal.util.StandardDateFormat;
@@ -65,7 +64,7 @@ public abstract class Decoder extends ReferencingFactoryContainer implements Clo
/**
* The logger to use for messages other than warnings specific to the file being read.
*/
- static final Logger LOGGER = Logging.getLogger(Modules.NETCDF);
+ static final Logger LOGGER = Logger.getLogger(Modules.NETCDF);
/**
* The format name to use in error message. We use lower-case "n" because it seems to be what the netCDF community uses.
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/AutoChecker.java b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/AutoChecker.java
index b6565114a6..86eda9c2ba 100644
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/AutoChecker.java
+++ b/storage/sis-shapefile/src/main/java/org/apache/sis/internal/shapefile/AutoChecker.java
@@ -25,8 +25,6 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.sis.internal.system.Modules;
-import org.apache.sis.util.logging.Logging;
-
/**
* Base class for objets having auto-checking abilities
@@ -35,7 +33,7 @@ import org.apache.sis.util.logging.Logging;
*/
public abstract class AutoChecker {
/** Logger. */
- static Logger LOGGER = Logging.getLogger(Modules.SHAPEFILE);
+ static Logger LOGGER = Logger.getLogger(Modules.SHAPEFILE);
/**
* Format a resource bundle message.
diff --git a/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/InputFeatureStream.java b/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/InputFeatureStream.java
index 968b9c711c..fe3500fcca 100644
--- a/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/InputFeatureStream.java
+++ b/storage/sis-shapefile/src/main/java/org/apache/sis/storage/shapefile/InputFeatureStream.java
@@ -38,7 +38,6 @@ import org.apache.sis.internal.shapefile.jdbc.sql.SQLUnsupportedParsingFeatureEx
import org.apache.sis.internal.shapefile.jdbc.statement.DBFStatement;
import org.apache.sis.internal.system.Modules;
import org.apache.sis.storage.DataStoreClosedException;
-import org.apache.sis.util.logging.Logging;
import org.opengis.feature.Feature;
/**
@@ -54,7 +53,7 @@ import org.opengis.feature.Feature;
*/
public class InputFeatureStream extends InputStream {
/** Logger. */
- private static final Logger LOGGER = Logging.getLogger(Modules.SHAPEFILE);
+ private static final Logger LOGGER = Logger.getLogger(Modules.SHAPEFILE);
/** Resource bundle. */
private ResourceBundle rsc = ResourceBundle.getBundle(InputFeatureStream.class.getName());
diff --git a/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/AbstractTestBaseForInternalJDBC.java b/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/AbstractTestBaseForInternalJDBC.java
index ffa2220054..62d79b1a42 100644
--- a/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/AbstractTestBaseForInternalJDBC.java
+++ b/storage/sis-shapefile/src/test/java/org/apache/sis/internal/shapefile/jdbc/AbstractTestBaseForInternalJDBC.java
@@ -29,7 +29,6 @@ import java.util.logging.Logger;
import org.apache.sis.storage.shapefile.ShapeFileTest;
import org.apache.sis.test.TestCase;
-import org.apache.sis.util.logging.Logging;
import org.junit.Before;
/**
@@ -39,7 +38,7 @@ import org.junit.Before;
*/
public abstract class AbstractTestBaseForInternalJDBC extends TestCase {
/** Logger. */
- protected Logger log = Logging.getLogger(getClass());
+ protected Logger log = Logger.getLogger("org.apache.sis.internal.shapefile.jdbc");
/** The database file to use for testing purpose. */
protected File dbfFile;
diff --git a/storage/sis-shapefile/src/test/java/org/apache/sis/storage/shapefile/ShapeFileTest.java b/storage/sis-shapefile/src/test/java/org/apache/sis/storage/shapefile/ShapeFileTest.java
index 6605b248ef..86d8fbfd74 100644
--- a/storage/sis-shapefile/src/test/java/org/apache/sis/storage/shapefile/ShapeFileTest.java
+++ b/storage/sis-shapefile/src/test/java/org/apache/sis/storage/shapefile/ShapeFileTest.java
@@ -91,7 +91,7 @@ public final strictfp class ShapeFileTest extends TestCase {
*/
@Test
public void testDescriptors() throws URISyntaxException, DataStoreException {
- Logger log = org.apache.sis.util.logging.Logging.getLogger(ShapeFileTest.class);
+ Logger log = Logger.getLogger("org.apache.sis.storage.shapefile");
ShapeFile shp = new ShapeFile(path("ABRALicenseePt_4326_clipped.shp"));
shp.loadDescriptors();
@@ -119,7 +119,7 @@ public final strictfp class ShapeFileTest extends TestCase {
ShapeFile shp = new ShapeFile(path("DEPARTEMENT.SHP"));
Feature first = null, last = null;
- Logger log = org.apache.sis.util.logging.Logging.getLogger(ShapeFileTest.class);
+ Logger log = Logger.getLogger("org.apache.sis.storage.shapefile");
try(InputFeatureStream is = shp.findAll()) {
Feature feature = is.readFeature();
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java
index 0ea7a4eb80..7f653ac1fc 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/DocumentedStoreProvider.java
@@ -18,11 +18,11 @@ package org.apache.sis.internal.storage;
import java.util.logging.Level;
import java.util.logging.LogRecord;
+import java.util.logging.Logger;
import org.opengis.metadata.distribution.Format;
import org.apache.sis.metadata.sql.MetadataSource;
import org.apache.sis.metadata.sql.MetadataStoreException;
import org.apache.sis.storage.event.StoreListeners;
-import org.apache.sis.util.logging.Logging;
import org.apache.sis.internal.system.Modules;
@@ -101,7 +101,7 @@ public abstract class DocumentedStoreProvider extends URIDataStore.Provider {
if (listeners != null) {
listeners.warning(record);
} else {
- Logging.getLogger(Modules.STORAGE).log(record);
+ Logger.getLogger(Modules.STORAGE).log(record);
}
}
format = super.getFormat();
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java
index c41f894de2..cd8fd65d9a 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/internal/storage/StoreUtilities.java
@@ -51,7 +51,6 @@ import org.apache.sis.internal.system.Modules;
import org.apache.sis.util.resources.Errors;
import org.apache.sis.util.CharSequences;
import org.apache.sis.util.Classes;
-import org.apache.sis.util.logging.Logging;
// Branch-dependent imports
import org.opengis.feature.Feature;
@@ -72,7 +71,7 @@ public final class StoreUtilities extends Static {
* Logger for the {@value Modules#STORAGE} module. This is used when no more specific logger is available,
* or if the more specific logger is not appropriate (e.g. because the log message come from base class).
*/
- public static final Logger LOGGER = Logging.getLogger(Modules.STORAGE);
+ public static final Logger LOGGER = Logger.getLogger(Modules.STORAGE);
/**
* Names of encoding where bytes less than 128 can be interpreted as ASCII.
diff --git a/storage/sis-storage/src/main/java/org/apache/sis/storage/event/StoreListeners.java b/storage/sis-storage/src/main/java/org/apache/sis/storage/event/StoreListeners.java
index 8e4e4ac2d9..c6c1164ecc 100644
--- a/storage/sis-storage/src/main/java/org/apache/sis/storage/event/StoreListeners.java
+++ b/storage/sis-storage/src/main/java/org/apache/sis/storage/event/StoreListeners.java
@@ -551,7 +551,7 @@ public class StoreListeners implements Localized {
final String name = description.getLoggerName();
final Logger logger;
if (name != null) {
- logger = Logging.getLogger(name);
+ logger = Logger.getLogger(name);
} else {
logger = getLogger();
description.setLoggerName(logger.getName());