Top Description Inners Fields Constructors Methods
org.jboss.modules

public final Class ModuleLoggerFinder

extends LoggerFinder
Class Inheritance
Imports
java.lang.System.LoggerFinder, java.security.AccessController, .PrivilegedAction, java.util.Arrays, .Deque, .EnumMap, .Iterator, .Map, .ResourceBundle, .ServiceLoader, java.util.concurrent.ConcurrentHashMap, .LinkedBlockingDeque, java.util.concurrent.atomic.AtomicReference, java.util.concurrent.locks.ReentrantLock, java.util.function.Supplier, java.util.logging.Logger

A logger finder which attempts to locate a LoggerFinder on the log managers class path. If not found a default finder will be used.
Author
James R. Perkins

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private static class
private static class

Field Summary

Modifier and TypeField and Description
private static volatile boolean
private static final Supplier<System.LoggerFinder>
private static volatile System.LoggerFinder
private static final ReentrantLock
private static final Map<String, System.Logger>
private static final Deque<ModuleLoggerFinder.SystemLogRecord>
private static final System.LoggerFinder

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv static void
activate(final ClassLoader
the class loader to use
cl
)

Activates the module logger and replaces any old delegating system loggers with a logger from the new finder.

public System.Logger
getLogger(final String
the name of the logger.
name
,
final Module
the module for which the logger is being requested.
module
)

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

Returns an instance of Logger for the given module.
Inherited from java.lang.System.LoggerFinder:
getLocalizedLoggergetLoggerFinder

Field Detail

activatedback to summary
private static volatile boolean activated
defaultFinderback to summary
private static final Supplier<System.LoggerFinder> defaultFinder
finderback to summary
private static volatile System.LoggerFinder finder
lockback to summary
private static final ReentrantLock lock
loggersback to summary
private static final Map<String, System.Logger> loggers
messagesback to summary
private static final Deque<ModuleLoggerFinder.SystemLogRecord> messages
queueingFinderback to summary
private static final System.LoggerFinder queueingFinder

Constructor Detail

ModuleLoggerFinderback to summary
public ModuleLoggerFinder()

Method Detail

activateback to summary
pack-priv static void activate(final ClassLoader cl)

Activates the module logger and replaces any old delegating system loggers with a logger from the new finder.

Parameters
cl:ClassLoader

the class loader to use

getLoggerback to summary
public System.Logger getLogger(final String name, final 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.

Parameters
name:String

the name of the logger.

module:Module

the module for which the logger is being requested.

Returns:System.Logger

a logger suitable for use within the given module.

Annotations
@Override
org.jboss.modules back to summary

private Class ModuleLoggerFinder.DelegatingSystemLogger

extends Object
implements Logger
Class Inheritance
All Implemented Interfaces
java.lang.System.Logger

Field Summary

Modifier and TypeField and Description
private final AtomicReference<System.Logger>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private System.Logger
public String
getName()

Implements java.lang.System.Logger.getName.

Returns the name of this logger.
public boolean
isLoggable(final 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
log(final System.Logger.Level
the log message level.
level
,
final 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(final System.Logger.Level
the log message level.
level
,
final 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(final System.Logger.Level
the log message level.
level
,
final Object
the object to log.
obj
)

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

Logs a message produced from the given object.
public void
log(final System.Logger.Level
the log message level.
level
,
final String
the string message (or a key in the message catalog, if this logger is a localized logger); can be null.
msg
,
final 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(final System.Logger.Level
one of the log message level identifiers.
level
,
final Supplier<String>
a supplier function that produces a message.
msgSupplier
,
final 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(final System.Logger.Level
one of the log message level identifiers.
level
,
final 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
,
final 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(final System.Logger.Level
the log message level.
level
,
final ResourceBundle
a resource bundle to localize msg; can be null.
bundle
,
final String
the string message (or a key in the message catalog, if bundle is not null); can be null.
msg
,
final 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(final System.Logger.Level
the log message level.
level
,
final ResourceBundle
a resource bundle to localize format; can be null.
bundle
,
final 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
,
final 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.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delegateback to summary
private final AtomicReference<System.Logger> delegate

Constructor Detail

DelegatingSystemLoggerback to summary
private DelegatingSystemLogger(final System.Logger delegate)

Method Detail

getDelegateback to summary
private System.Logger getDelegate()
getNameback to summary
public String getName()

Implements java.lang.System.Logger.getName.

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

Returns the name of this logger.

Returns:String

the logger name.

Annotations
@Override
isLoggableback to summary
public boolean isLoggable(final 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(final System.Logger.Level level, final 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(final System.Logger.Level level, final 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(final System.Logger.Level level, final 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(final System.Logger.Level level, final String msg, final 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(final System.Logger.Level level, final Supplier<String> msgSupplier, final 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(final System.Logger.Level level, final String format, final 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(final System.Logger.Level level, final ResourceBundle bundle, final String msg, final 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.

msg: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(final System.Logger.Level level, final ResourceBundle bundle, final String format, final 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
org.jboss.modules back to summary

private Class ModuleLoggerFinder.JulSystemLogger

extends Object
implements Logger
Class Inheritance
All Implemented Interfaces
java.lang.System.Logger

Field Summary

Modifier and TypeField and Description
private final Logger
private static final Map<System.Logger.Level, Level>

Constructor Summary

AccessConstructor and Description
private
JulSystemLogger(final Logger delegate)

Method Summary

Modifier and TypeMethod and Description
public String
getName()

Implements java.lang.System.Logger.getName.

Returns the name of this logger.
public boolean
isLoggable(final 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
log(final System.Logger.Level
the log message level.
level
,
final ResourceBundle
a resource bundle to localize msg; can be null.
bundle
,
final String
the string message (or a key in the message catalog, if bundle is not null); can be null.
msg
,
final 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(final System.Logger.Level
the log message level.
level
,
final ResourceBundle
a resource bundle to localize format; can be null.
bundle
,
final 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
,
final 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.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

delegateback to summary
private final Logger delegate
LEVELSback to summary
private static final Map<System.Logger.Level, Level> LEVELS

Constructor Detail

JulSystemLoggerback to summary
private JulSystemLogger(final Logger delegate)

Method Detail

getNameback to summary
public String getName()

Implements java.lang.System.Logger.getName.

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

Returns the name of this logger.

Returns:String

the logger name.

Annotations
@Override
isLoggableback to summary
public boolean isLoggable(final 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(final System.Logger.Level level, final ResourceBundle bundle, final String msg, final 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.

msg: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(final System.Logger.Level level, final ResourceBundle bundle, final String format, final 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
org.jboss.modules back to summary

private Class ModuleLoggerFinder.QueueingSystemLogger

extends Object
implements Logger
Class Inheritance
All Implemented Interfaces
java.lang.System.Logger

Field Summary

Modifier and TypeField and Description
private static final System.Logger.Level
private final Module
private final String

Constructor Summary

AccessConstructor and Description
private
QueueingSystemLogger(final String name, final Module module)

Method Summary

Modifier and TypeMethod and Description
public String
getName()

Implements java.lang.System.Logger.getName.

Returns the name of this logger.
public boolean
isLoggable(final 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
log(final System.Logger.Level
the log message level.
level
,
final ResourceBundle
a resource bundle to localize msg; can be null.
bundle
,
final String
the string message (or a key in the message catalog, if bundle is not null); can be null.
msg
,
final 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(final System.Logger.Level
the log message level.
level
,
final ResourceBundle
a resource bundle to localize format; can be null.
bundle
,
final 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
,
final 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.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DEFAULT_LEVELback to summary
private static final System.Logger.Level DEFAULT_LEVEL
moduleback to summary
private final Module module
nameback to summary
private final String name

Constructor Detail

QueueingSystemLoggerback to summary
private QueueingSystemLogger(final String name, final Module module)

Method Detail

getNameback to summary
public String getName()

Implements java.lang.System.Logger.getName.

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

Returns the name of this logger.

Returns:String

the logger name.

Annotations
@Override
isLoggableback to summary
public boolean isLoggable(final 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(final System.Logger.Level level, final ResourceBundle bundle, final String msg, final 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.

msg: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(final System.Logger.Level level, final ResourceBundle bundle, final String format, final 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
org.jboss.modules back to summary

private Class ModuleLoggerFinder.SystemLogRecord

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final ResourceBundle
private final Throwable
private final System.Logger.Level
private final Module
private final String
private final String
private final Object[]

Constructor Summary

AccessConstructor and Description
private
SystemLogRecord(final String name, final Module module, final System.Logger.Level level, final ResourceBundle bundle, final String msg, final Object[] params, final Throwable cause)

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

bundleback to summary
private final ResourceBundle bundle
causeback to summary
private final Throwable cause
levelback to summary
private final System.Logger.Level level
moduleback to summary
private final Module module
msgback to summary
private final String msg
nameback to summary
private final String name
paramsback to summary
private final Object[] params

Constructor Detail

SystemLogRecordback to summary
private SystemLogRecord(final String name, final Module module, final System.Logger.Level level, final ResourceBundle bundle, final String msg, final Object[] params, final Throwable cause)

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override