APIdia Launch Partner
Top Description Inners Constructors Methods
jdk.internal.logger

public Class DefaultLoggerFinder

extends LoggerFinder
Class Inheritance
Imports
jdk.internal.misc.VM, java.lang.ref.Reference, .WeakReference, .ReferenceQueue, java.util.HashMap, .Map, .Objects, .Collection, .ResourceBundle, java.util.function.Function, java.lang.System.LoggerFinder, .System.Logger

Internal Service Provider Interface (SPI) that makes it possible to use java.util.logging as backend when the sun.util.logging.internal.LoggingProviderImpl is present.

The JDK default implementation of the LoggerFinder will attempt to locate and load an installed implementation of the DefaultLoggerFinder. If java.util.logging is present, this will usually resolve to an instance of sun.util.logging.internal.LoggingProviderImpl. Otherwise, if no concrete service provider is declared for DefaultLoggerFinder, the default implementation provided by this class will be used.

When the sun.util.logging.internal.LoggingProviderImpl is not present then the default implementation provided by this class is to use a simple logger that will log messages whose level is INFO and above to the console. These simple loggers are not configurable.

When configuration is needed, an application should either link with java.util.logging - and use the java.util.logging for configuration, or link with another implementation of the LoggerFinder that provides the necessary configuration.

API Note

Programmers are not expected to call this class directly. Instead, they should rely on the static methods defined by java.lang.System or sun.util.logging.PlatformLogger.

See Also
java.lang.System.LoggerFinder, jdk.internal.logger, sun.util.logging.internal

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Constructor Summary

AccessConstructor and Description
protected
DefaultLoggerFinder()

Creates a new instance of DefaultLoggerFinder.

Method Summary

Modifier and TypeMethod and Description
protected System.Logger

Returns:

A logger suitable for the application usage.
demandLoggerFor
(String
The name of the logger.
name
,
Module
The module on behalf of which the logger is created.
module
)

Returns a logger suitable for use within the given module.

public final System.Logger
getLocalizedLogger(String name, ResourceBundle bundle, Module module)

Overrides java.lang.System.LoggerFinder.getLocalizedLogger.

Returns a localizable instance of Logger for the given module.

public final System.Logger
getLogger(String name, Module module)

Implements abstract java.lang.System.LoggerFinder.getLogger.

Returns an instance of Logger for the given module.

public static boolean
Inherited from java.lang.System.LoggerFinder:
getLoggerFinder

Constructor Detail

DefaultLoggerFinderback to summary
protected DefaultLoggerFinder()

Creates a new instance of DefaultLoggerFinder.

Method Detail

demandLoggerForback to summary
protected System.Logger demandLoggerFor(String name, Module module)

Returns a logger suitable for use within the given module.

Implementation Specification

The default implementation for this method is to return a simple logger that will print all messages of INFO level and above to the console. That simple logger is not configurable.

Parameters
name:String

The name of the logger.

module:Module

The module on behalf of which the logger is created.

Returns:System.Logger

A logger suitable for the application usage.

getLocalizedLoggerback to summary
public final System.Logger getLocalizedLogger(String name, ResourceBundle bundle, Module module)

Overrides java.lang.System.LoggerFinder.getLocalizedLogger.

Doc from java.lang.System.LoggerFinder.getLocalizedLogger.

Returns a localizable instance of Logger for the given module. The returned logger will use the provided resource bundle for message localization.

Annotations
@Override
getLoggerback to summary
public final System.Logger getLogger(String name, Module module)

Implements abstract java.lang.System.LoggerFinder.getLogger.

Doc from java.lang.System.LoggerFinder.getLogger.

Returns an instance of Logger for the given module.

Annotations
@Override
isSystemback to summary
public static boolean isSystem(Module m)
jdk.internal.logger back to summary

pack-priv final Class DefaultLoggerFinder.SharedLoggers

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv static final DefaultLoggerFinder.SharedLoggers
private final Map<String, Reference<System.Logger>>
private final ReferenceQueue<System.Logger>
pack-priv static final DefaultLoggerFinder.SharedLoggers

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv synchronized System.Logger
get(Function<String, System.Logger> loggerSupplier, final String name)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

applicationback to summary
pack-priv static final DefaultLoggerFinder.SharedLoggers application
loggersback to summary
private final Map<String, Reference<System.Logger>> loggers
queueback to summary
private final ReferenceQueue<System.Logger> queue
systemback to summary
pack-priv static final DefaultLoggerFinder.SharedLoggers system

Constructor Detail

SharedLoggersback to summary
pack-priv SharedLoggers()

Method Detail

getback to summary
pack-priv synchronized System.Logger get(Function<String, System.Logger> loggerSupplier, final String name)