Top Description Inners Fields Constructors Methods
sun.util.logging.internal

public final Class LoggingProviderImpl

extends DefaultLoggerFinder
Class Inheritance
Imports
java.security.AccessController, .PrivilegedAction, java.util.ResourceBundle, .Objects, java.util.function.Supplier, java.lang.System.LoggerFinder, .System.Logger, java.util.logging.LogManager, .LoggingPermission, jdk.internal.logger.DefaultLoggerFinder, sun.util.logging.PlatformLogger, .PlatformLogger.ConfigurableBridge.LoggerConfiguration

This LoggingProviderImpl is the JDK internal implementation of the jdk.internal.logger.DefaultLoggerFinder which is used by the default implementation of the Logger when no LoggerFinder is found and java.util.logging is present. When java.util.logging is present, the LoggingProviderImpl is installed as an internal service provider, making it possible to use java.util.logging as the backend for loggers returned by the default LoggerFinder implementation.

This implementation of DefaultLoggerFinder returns instances of java.lang.System.Logger which delegate to a wrapped instance of java.util.logging.Logger.
Loggers returned by this class can therefore be configured by accessing their wrapped implementation through the regular java.util.logging APIs - such as java.util.logging.LogManager and java.util.logging.Logger.

API Note

Programmers are not expected to call this class directly. Instead they should rely on the static methods defined by java.lang.System.

To replace this default java.util.logging backend, an application is expected to install its own java.lang.System.LoggerFinder.

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

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
LoggingProviderImpl.JULWrapper

A logger that delegates to a java.util.logging.Logger delegate.

public static interface

Field Summary

Modifier and TypeField and Description
pack-priv static final RuntimePermission
private static final LoggingPermission
private static volatile LoggingProviderImpl.LogManagerAccess

Constructor Summary

AccessConstructor and Description
public
LoggingProviderImpl()

Creates a new instance of LoggingProviderImpl.

Method Summary

Modifier and TypeMethod and Description
private static Logger

Returns:

a Logger suitable for use in the given module.
demandJULLoggerFor
(final String
the logger name.
name
,
Module
the module for which the logger should be created.
module
)

Creates a java.util.logging.Logger for the given module.

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
)

Overrides jdk.internal.logger.DefaultLoggerFinder.demandLoggerFor.

Returns a logger suitable for use within the given module.
public static LoggingProviderImpl.LogManagerAccess
public static void
Inherited from jdk.internal.logger.DefaultLoggerFinder:
getLocalizedLoggergetLoggerisSystem

Field Detail

LOGGERFINDER_PERMISSIONback to summary
pack-priv static final RuntimePermission LOGGERFINDER_PERMISSION

Hides jdk.internal.logger.DefaultLoggerFinder.LOGGERFINDER_PERMISSION.

LOGGING_CONTROL_PERMISSIONback to summary
private static final LoggingPermission LOGGING_CONTROL_PERMISSION
logManagerAccessback to summary
private static volatile LoggingProviderImpl.LogManagerAccess logManagerAccess

Constructor Detail

LoggingProviderImplback to summary
public LoggingProviderImpl()

Creates a new instance of LoggingProviderImpl.

Exceptions
SecurityException:
if the calling code does not have the RuntimePermission("loggerFinder").

Method Detail

demandJULLoggerForback to summary
private static Logger demandJULLoggerFor(final String name, Module module)

Creates a java.util.logging.Logger for the given module.

Parameters
name:String

the logger name.

module:Module

the module for which the logger should be created.

Returns:Logger

a Logger suitable for use in the given module.

Annotations
@SuppressWarnings:removal
demandLoggerForback to summary
protected System.Logger demandLoggerFor(String name, Module module)

Overrides jdk.internal.logger.DefaultLoggerFinder.demandLoggerFor.

Doc from jdk.internal.logger.DefaultLoggerFinder.demandLoggerFor.

Returns a logger suitable for use within the given module.

API Note

The logger returned by this method can be configured through its corresponding java.util.logging.Logger backend.

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.

Annotations
@Override
Exceptions
SecurityException:
if the calling code doesn't have the RuntimePermission("loggerFinder").
getLogManagerAccessback to summary
public static LoggingProviderImpl.LogManagerAccess getLogManagerAccess()
setLogManagerAccessback to summary
public static void setLogManagerAccess(LoggingProviderImpl.LogManagerAccess accesLoggers)
sun.util.logging.internal back to summary

pack-priv final Class LoggingProviderImpl.JULWrapper

extends LoggerConfiguration
implements Logger, Bridge, ConfigurableBridge
Class Inheritance
All Implemented Interfaces
sun.util.logging.PlatformLogger.ConfigurableBridge, sun.util.logging.PlatformLogger.Bridge, java.lang.System.Logger

A logger that delegates to a java.util.logging.Logger delegate.

Field Summary

Modifier and TypeField and Description
private final Logger
private static final Level[]
private static final Level[]

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
the reference object with which to compare.
obj
)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.
public PlatformLogger.ConfigurableBridge.LoggerConfiguration
public String
public PlatformLogger.Level
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.
public boolean
public boolean
isLoggable(PlatformLogger.Level
the level
level
)

Implements sun.util.logging.PlatformLogger.Bridge.isLoggable.

Returns true if a message of the given level would actually be logged by this logger.
public boolean
isLoggable(System.Logger.Level
the log message level.
level
)

Implements java.lang.System.Logger.isLoggable.

Checks if a message of the given level would be logged by this logger.
public void
public void
public void
public void
public void
public void
log(System.Logger.Level
the log message level.
level
,
String
the string message (or a key in the message catalog, if this logger is a localized logger); can be null.
msg
)

Overrides default java.lang.System.Logger.log.

Logs a message.
public void
log(System.Logger.Level
the log message level.
level
,
Supplier<String>
a supplier function that produces a message.
msgSupplier
)

Overrides default java.lang.System.Logger.log.

Logs a lazily supplied message.
public void
log(System.Logger.Level
the log message level.
level
,
Object
the object to log.
obj
)

Overrides default java.lang.System.Logger.log.

Logs a message produced from the given object.
public void
log(System.Logger.Level
the log message level.
level
,
String
the string message (or a key in the message catalog, if this logger is a localized logger); can be null.
msg
,
Throwable
a Throwable associated with the log message; can be null.
thrown
)

Overrides default java.lang.System.Logger.log.

Logs a message associated with a given throwable.
public void
log(System.Logger.Level
one of the log message level identifiers.
level
,
Supplier<String>
a supplier function that produces a message.
msgSupplier
,
Throwable
a Throwable associated with log message; can be null.
thrown
)

Overrides default java.lang.System.Logger.log.

Logs a lazily supplied message associated with a given throwable.
public void
log(System.Logger.Level
one of the log message level identifiers.
level
,
String
the string message format in java.text.MessageFormat format, (or a key in the message catalog, if this logger is a localized logger); can be null.
format
,
Object...
an optional list of parameters to the message (may be none).
params
)

Overrides default java.lang.System.Logger.log.

Logs a message with an optional list of parameters.
public void
log(System.Logger.Level
the log message level.
level
,
ResourceBundle
a resource bundle to localize msg; can be null.
bundle
,
String
the string message (or a key in the message catalog, if bundle is not null); can be null.
key
,
Throwable
a Throwable associated with the log message; can be null.
thrown
)

Implements java.lang.System.Logger.log.

Logs a localized message associated with a given throwable.
public void
log(System.Logger.Level
the log message level.
level
,
ResourceBundle
a resource bundle to localize format; can be null.
bundle
,
String
the string message format in java.text.MessageFormat format, (or a key in the message catalog if bundle is not null); can be null.
format
,
Object...
an optional list of parameters to the message (may be none).
params
)

Implements java.lang.System.Logger.log.

Logs a message with resource bundle and an optional list of parameters.
public void
logp(PlatformLogger.Level level, String sourceClass, String sourceMethod, String msg)

Implements sun.util.logging.PlatformLogger.Bridge.logp.

public void
logp(PlatformLogger.Level level, String sourceClass, String sourceMethod, Supplier<String> msgSupplier)

Implements sun.util.logging.PlatformLogger.Bridge.logp.

public void
logp(PlatformLogger.Level level, String sourceClass, String sourceMethod, String msg, Object... params)

Implements sun.util.logging.PlatformLogger.Bridge.logp.

public void
logp(PlatformLogger.Level level, String sourceClass, String sourceMethod, String msg, Throwable thrown)

Implements sun.util.logging.PlatformLogger.Bridge.logp.

public void
logp(PlatformLogger.Level level, String sourceClass, String sourceMethod, Throwable thrown, Supplier<String> msgSupplier)

Implements sun.util.logging.PlatformLogger.Bridge.logp.

public void
public void
public void
logrb(PlatformLogger.Level level, String sourceClass, String sourceMethod, ResourceBundle bundle, String key, Object... params)

Implements sun.util.logging.PlatformLogger.Bridge.logrb.

public void
logrb(PlatformLogger.Level level, String sourceClass, String sourceMethod, ResourceBundle bundle, String key, Throwable thrown)

Implements sun.util.logging.PlatformLogger.Bridge.logrb.

pack-priv static LoggingProviderImpl.JULWrapper
of(Logger logger)

public void
pack-priv static Level
pack-priv static Level

Field Detail

julLoggerback to summary
private final Logger julLogger
platform2JulLevelMappingback to summary
private static final Level[] platform2JulLevelMapping
spi2JulLevelMappingback to summary
private static final Level[] spi2JulLevelMapping

Constructor Detail

JULWrapperback to summary
private JULWrapper(Logger logger)

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
obj:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getLoggerConfigurationback to summary
public PlatformLogger.ConfigurableBridge.LoggerConfiguration getLoggerConfiguration()

Overrides default sun.util.logging.PlatformLogger.ConfigurableBridge.getLoggerConfiguration.

Annotations
@Override
getNameback to summary
public String getName()

Implements java.lang.System.Logger.getName, sun.util.logging.PlatformLogger.Bridge.getName.

Doc from java.lang.System.Logger.getName.

Returns the name of this logger.

Returns:String

the logger name.

Annotations
@Override
getPlatformLevelback to summary
public PlatformLogger.Level getPlatformLevel()

Implements abstract sun.util.logging.PlatformLogger.ConfigurableBridge.LoggerConfiguration.getPlatformLevel.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object

Annotations
@Override
isEnabledback to summary
public boolean isEnabled()

Implements sun.util.logging.PlatformLogger.Bridge.isEnabled.

Annotations
@Override
isLoggableback to summary
public boolean isLoggable(PlatformLogger.Level level)

Implements sun.util.logging.PlatformLogger.Bridge.isLoggable.

Doc from sun.util.logging.PlatformLogger.Bridge.isLoggable.

Returns true if a message of the given level would actually be logged by this logger.

Parameters
level:PlatformLogger.Level

the level

Returns:boolean

whether a message of that level would be logged

Annotations
@Override
isLoggableback to summary
public boolean isLoggable(System.Logger.Level level)

Implements java.lang.System.Logger.isLoggable.

Doc from java.lang.System.Logger.isLoggable.

Checks if a message of the given level would be logged by this logger.

Parameters
level:System.Logger.Level

the log message level.

Returns:boolean

true if the given log message level is currently being logged.

Annotations
@Override
logback to summary
public void log(PlatformLogger.Level level, String msg, Throwable throwable)

Implements sun.util.logging.PlatformLogger.Bridge.log.

Annotations
@Override
logback to summary
public void log(PlatformLogger.Level level, String format, Object... params)

Implements sun.util.logging.PlatformLogger.Bridge.log.

Annotations
@Override
logback to summary
public void log(PlatformLogger.Level level, String msg)

Implements sun.util.logging.PlatformLogger.Bridge.log.

Annotations
@Override
logback to summary
public void log(PlatformLogger.Level level, Supplier<String> msgSuppier)

Implements sun.util.logging.PlatformLogger.Bridge.log.

Annotations
@Override
logback to summary
public void log(PlatformLogger.Level level, Throwable thrown, Supplier<String> msgSuppier)

Implements sun.util.logging.PlatformLogger.Bridge.log.

Annotations
@Override
logback to summary
public void log(System.Logger.Level level, String msg)

Overrides default java.lang.System.Logger.log.

Doc from java.lang.System.Logger.log.

Logs a message.

Parameters
level:System.Logger.Level

the log message level.

msg:String

the string message (or a key in the message catalog, if this logger is a localized logger); can be null.

Annotations
@Override
logback to summary
public void log(System.Logger.Level level, Supplier<String> msgSupplier)

Overrides default java.lang.System.Logger.log.

Doc from java.lang.System.Logger.log.

Logs a lazily supplied message. If the logger is currently enabled for the given log message level then a message is logged that is the result produced by the given supplier function. Otherwise, the supplier is not operated on.

Parameters
level:System.Logger.Level

the log message level.

msgSupplier:Supplier<String>

a supplier function that produces a message.

Annotations
@Override
logback to summary
public void log(System.Logger.Level level, Object obj)

Overrides default java.lang.System.Logger.log.

Doc from java.lang.System.Logger.log.

Logs a message produced from the given object. If the logger is currently enabled for the given log message level then a message is logged that, by default, is the result produced from calling toString on the given object. Otherwise, the object is not operated on.

Parameters
level:System.Logger.Level

the log message level.

obj:Object

the object to log.

Annotations
@Override
logback to summary
public void log(System.Logger.Level level, String msg, Throwable thrown)

Overrides default java.lang.System.Logger.log.

Doc from java.lang.System.Logger.log.

Logs a message associated with a given throwable.

Parameters
level:System.Logger.Level

the log message level.

msg:String

the string message (or a key in the message catalog, if this logger is a localized logger); can be null.

thrown:Throwable

a Throwable associated with the log message; can be null.

Annotations
@Override
logback to summary
public void log(System.Logger.Level level, Supplier<String> msgSupplier, Throwable thrown)

Overrides default java.lang.System.Logger.log.

Doc from java.lang.System.Logger.log.

Logs a lazily supplied message associated with a given throwable. If the logger is currently enabled for the given log message level then a message is logged that is the result produced by the given supplier function. Otherwise, the supplier is not operated on.

Parameters
level:System.Logger.Level

one of the log message level identifiers.

msgSupplier:Supplier<String>

a supplier function that produces a message.

thrown:Throwable

a Throwable associated with log message; can be null.

Annotations
@Override
logback to summary
public void log(System.Logger.Level level, String format, Object... params)

Overrides default java.lang.System.Logger.log.

Doc from java.lang.System.Logger.log.

Logs a message with an optional list of parameters.

Parameters
level:System.Logger.Level

one of the log message level identifiers.

format:String

the string message format in java.text.MessageFormat format, (or a key in the message catalog, if this logger is a localized logger); can be null.

params:Object[]

an optional list of parameters to the message (may be none).

Annotations
@Override
logback to summary
public void log(System.Logger.Level level, ResourceBundle bundle, String key, Throwable thrown)

Implements java.lang.System.Logger.log.

Doc from java.lang.System.Logger.log.

Logs a localized message associated with a given throwable. If the given resource bundle is non-null, the msg string is localized using the given resource bundle. Otherwise the msg string is not localized.

Parameters
level:System.Logger.Level

the log message level.

bundle:ResourceBundle

a resource bundle to localize msg; can be null.

key:String

the string message (or a key in the message catalog, if bundle is not null); can be null.

thrown:Throwable

a Throwable associated with the log message; can be null.

Annotations
@Override
logback to summary
public void log(System.Logger.Level level, ResourceBundle bundle, String format, Object... params)

Implements java.lang.System.Logger.log.

Doc from java.lang.System.Logger.log.

Logs a message with resource bundle and an optional list of parameters. If the given resource bundle is non-null, the format string is localized using the given resource bundle. Otherwise the format string is not localized.

Parameters
level:System.Logger.Level

the log message level.

bundle:ResourceBundle

a resource bundle to localize format; can be null.

format:String

the string message format in java.text.MessageFormat format, (or a key in the message catalog if bundle is not null); can be null.

params:Object[]

an optional list of parameters to the message (may be none).

Annotations
@Override
logpback to summary
public void logp(PlatformLogger.Level level, String sourceClass, String sourceMethod, String msg)

Implements sun.util.logging.PlatformLogger.Bridge.logp.

Annotations
@Override
logpback to summary
public void logp(PlatformLogger.Level level, String sourceClass, String sourceMethod, Supplier<String> msgSupplier)

Implements sun.util.logging.PlatformLogger.Bridge.logp.

Annotations
@Override
logpback to summary
public void logp(PlatformLogger.Level level, String sourceClass, String sourceMethod, String msg, Object... params)

Implements sun.util.logging.PlatformLogger.Bridge.logp.

Annotations
@Override
logpback to summary
public void logp(PlatformLogger.Level level, String sourceClass, String sourceMethod, String msg, Throwable thrown)

Implements sun.util.logging.PlatformLogger.Bridge.logp.

Annotations
@Override
logpback to summary
public void logp(PlatformLogger.Level level, String sourceClass, String sourceMethod, Throwable thrown, Supplier<String> msgSupplier)

Implements sun.util.logging.PlatformLogger.Bridge.logp.

Annotations
@Override
logrbback to summary
public void logrb(PlatformLogger.Level level, ResourceBundle bundle, String key, Throwable throwable)

Implements sun.util.logging.PlatformLogger.Bridge.logrb.

Annotations
@Override
logrbback to summary
public void logrb(PlatformLogger.Level level, ResourceBundle bundle, String key, Object... params)

Implements sun.util.logging.PlatformLogger.Bridge.logrb.

Annotations
@Override
logrbback to summary
public void logrb(PlatformLogger.Level level, String sourceClass, String sourceMethod, ResourceBundle bundle, String key, Object... params)

Implements sun.util.logging.PlatformLogger.Bridge.logrb.

Annotations
@Override
logrbback to summary
public void logrb(PlatformLogger.Level level, String sourceClass, String sourceMethod, ResourceBundle bundle, String key, Throwable thrown)

Implements sun.util.logging.PlatformLogger.Bridge.logrb.

Annotations
@Override
ofback to summary
pack-priv static LoggingProviderImpl.JULWrapper of(Logger logger)
setPlatformLevelback to summary
public void setPlatformLevel(PlatformLogger.Level level)

Implements abstract sun.util.logging.PlatformLogger.ConfigurableBridge.LoggerConfiguration.setPlatformLevel.

Annotations
@Override
toJULback to summary
pack-priv static Level toJUL(System.Logger.Level level)
toJULback to summary
pack-priv static Level toJUL(PlatformLogger.Level level)
sun.util.logging.internal back to summary

public Interface LoggingProviderImpl.LogManagerAccess

Known Direct Implementers
java.util.logging.LogManager.LoggingProviderAccess

Method Summary

Modifier and TypeMethod and Description
public Logger
demandLoggerFor(LogManager manager, String name, Module module)

Method Detail

demandLoggerForback to summary
public Logger demandLoggerFor(LogManager manager, String name, Module module)