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

public Class SimpleConsoleLogger

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
Known Direct Subclasses
jdk.internal.logger.SurrogateLogger
Imports
java.io.PrintStream, .PrintWriter, .StringWriter, java.lang.StackWalker.StackFrame, .System.Logger, java.time.ZonedDateTime, java.util.Optional, .MissingResourceException, .ResourceBundle, java.util.function.Function, .Predicate, .Supplier, sun.util.logging.PlatformLogger, .PlatformLogger.ConfigurableBridge.LoggerConfiguration

A simple console logger to emulate the behavior of JUL loggers when in the default configuration. SimpleConsoleLoggers are also used when JUL is not present and no DefaultLoggerFinder is installed.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv static final System.Logger.Level
pack-priv static final PlatformLogger.Level
pack-priv volatile PlatformLogger.Level
pack-priv final String
pack-priv final boolean

Constructor Summary

AccessConstructor and Description
pack-priv
SimpleConsoleLogger(String name, boolean usePlatformLevel)

Method Summary

Modifier and TypeMethod and Description
pack-priv PlatformLogger.Level
private PlatformLogger.Level
private synchronized String
format(Enum<?> level, String msg, Throwable thrown, String callerInfo)

private String
private String
getCallerInfo(String sourceClassName, String sourceMethodName)

pack-priv static System.Logger.Level
public final PlatformLogger.ConfigurableBridge.LoggerConfiguration
public final String
public final PlatformLogger.Level
pack-priv String
pack-priv static String
public final boolean
public final boolean
isLoggable(System.Logger.Level level)

Implements java.lang.System.Logger.isLoggable.

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

public final boolean
isLoggable(PlatformLogger.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 final void
log(System.Logger.Level level, ResourceBundle bundle, String key, Throwable thrown)

Implements java.lang.System.Logger.log.

Logs a localized message associated with a given throwable.

public final void
log(System.Logger.Level level, ResourceBundle bundle, String format, Object... params)

Implements java.lang.System.Logger.log.

Logs a message with resource bundle and an optional list of parameters.

public final void
public final void
public final void
public final void
public final void
private Enum<?>
private Enum<?>
public final void
logp(PlatformLogger.Level level, String sourceClass, String sourceMethod, String msg)

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

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

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

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

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

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

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

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

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

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

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

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

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

public final void
public final void
public static SimpleConsoleLogger
pack-priv static PrintStream
outputStream()

Default platform logging support - output messages to System.err - equivalent to ConsoleHandler with SimpleFormatter.

private void
publish(String callerInfo, Enum<?> level, String msg)

private void
publish(String callerInfo, Enum<?> level, String msg, Throwable thrown)

private void
publish(String callerInfo, Enum<?> level, String msg, Object... params)

public final void
private String

Field Detail

DEFAULT_LEVELback to summary
pack-priv static final System.Logger.Level DEFAULT_LEVEL
DEFAULT_PLATFORM_LEVELback to summary
pack-priv static final PlatformLogger.Level DEFAULT_PLATFORM_LEVEL
levelback to summary
pack-priv volatile PlatformLogger.Level level
nameback to summary
pack-priv final String name
usePlatformLevelback to summary
pack-priv final boolean usePlatformLevel

Constructor Detail

SimpleConsoleLoggerback to summary
pack-priv SimpleConsoleLogger(String name, boolean usePlatformLevel)

Method Detail

defaultPlatformLevelback to summary
pack-priv PlatformLogger.Level defaultPlatformLevel()
effectiveLevelback to summary
private PlatformLogger.Level effectiveLevel()
formatback to summary
private synchronized String format(Enum<?> level, String msg, Throwable thrown, String callerInfo)
getCallerInfoback to summary
private String getCallerInfo()
getCallerInfoback to summary
private String getCallerInfo(String sourceClassName, String sourceMethodName)
getDefaultLevelback to summary
pack-priv static System.Logger.Level getDefaultLevel()
getLoggerConfigurationback to summary
public final PlatformLogger.ConfigurableBridge.LoggerConfiguration getLoggerConfiguration()

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

Annotations
@Override
getNameback to summary
public final 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.

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

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

Annotations
@Override
getSimpleFormatStringback to summary
pack-priv String getSimpleFormatString()
getStringback to summary
pack-priv static String getString(ResourceBundle bundle, String key)
isEnabledback to summary
public final boolean isEnabled()

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

Annotations
@Override
isLoggableback to summary
public final 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.

Annotations
@Override
isLoggableback to summary
public final 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.

Annotations
@Override
logback to summary
public final 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.

Annotations
@Override
logback to summary
public final 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.

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

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

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

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

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

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

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

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

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

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

Annotations
@Override
logLevelback to summary
private Enum<?> logLevel(PlatformLogger.Level level)
logLevelback to summary
private Enum<?> logLevel(System.Logger.Level level)
logpback to summary
public final void logp(PlatformLogger.Level level, String sourceClass, String sourceMethod, String msg)

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

Annotations
@Override
logpback to summary
public final 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 final 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 final 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 final 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 final 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 final void logrb(PlatformLogger.Level level, String sourceClass, String sourceMethod, ResourceBundle bundle, String key, Throwable thrown)

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

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

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

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

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

Annotations
@Override
makeSimpleLoggerback to summary
public static SimpleConsoleLogger makeSimpleLogger(String name)
outputStreamback to summary
pack-priv static PrintStream outputStream()

Default platform logging support - output messages to System.err - equivalent to ConsoleHandler with SimpleFormatter.

publishback to summary
private void publish(String callerInfo, Enum<?> level, String msg)
publishback to summary
private void publish(String callerInfo, Enum<?> level, String msg, Throwable thrown)
publishback to summary
private void publish(String callerInfo, Enum<?> level, String msg, Object... params)
setPlatformLevelback to summary
public final void setPlatformLevel(PlatformLogger.Level newLevel)

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

Annotations
@Override
toStringback to summary
private String toString(Throwable thrown)
jdk.internal.logger back to summary

pack-priv final Class SimpleConsoleLogger.CallerFinder

extends Object
implements Predicate<StackWalker.StackFrame>
Class Inheritance
All Implemented Interfaces
java.util.function.Predicate

Field Summary

Modifier and TypeField and Description
private boolean
private static final StackWalker

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv Optional<StackWalker.StackFrame>

Returns:

StackFrame of the caller's frame.
get
()

Returns StackFrame of the caller's frame.

private boolean
public boolean

Returns:

true if we have found the caller's frame, false if the frame must be skipped.
test
(StackWalker.StackFrame
The frame info.
t
)

Implements java.util.function.Predicate.test.

Returns true if we have found the caller's frame, false if the frame must be skipped.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lookingForLoggerback to summary
private boolean lookingForLogger
WALKERback to summary
private static final StackWalker WALKER

Constructor Detail

CallerFinderback to summary
pack-priv CallerFinder()

Method Detail

getback to summary
pack-priv Optional<StackWalker.StackFrame> get()

Returns StackFrame of the caller's frame.

Returns:Optional<StackWalker.StackFrame>

StackFrame of the caller's frame.

isLoggerImplFrameback to summary
private boolean isLoggerImplFrame(String cname)
testback to summary
public boolean test(StackWalker.StackFrame t)

Implements java.util.function.Predicate.test.

Returns true if we have found the caller's frame, false if the frame must be skipped.

Parameters
t:StackWalker.StackFrame

The frame info.

Returns:boolean

true if we have found the caller's frame, false if the frame must be skipped.

Annotations
@Override
jdk.internal.logger back to summary

pack-priv final Class SimpleConsoleLogger.Formatting

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv static final String
pack-priv static final String
pack-priv static final String
pack-priv static final String
private static final String[]

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static String
formatMessage(String format, Object... parameters)

pack-priv static String
getSimpleFormat(String key, Function<String, String> defaultPropertyGetter)

pack-priv static boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_FORMATback to summary
pack-priv static final String DEFAULT_FORMAT
DEFAULT_FORMAT_PROP_KEYback to summary
pack-priv static final String DEFAULT_FORMAT_PROP_KEY
JUL_FORMAT_PROP_KEYback to summary
pack-priv static final String JUL_FORMAT_PROP_KEY
SIMPLE_CONSOLE_LOGGER_FORMATback to summary
pack-priv static final String SIMPLE_CONSOLE_LOGGER_FORMAT
skipsback to summary
private static final String[] skips

Constructor Detail

Formattingback to summary
pack-priv Formatting()

Method Detail

formatMessageback to summary
pack-priv static String formatMessage(String format, Object... parameters)
getSimpleFormatback to summary
pack-priv static String getSimpleFormat(String key, Function<String, String> defaultPropertyGetter)
isFilteredFrameback to summary
pack-priv static boolean isFilteredFrame(StackWalker.StackFrame st)