public interface LogContextInitializer
An initializer for log contexts. The initializer provides initial values for log instances within the context
for properties like levels, handlers, and so on.
The initial log context will be configured using a context initializer that is located via the JDK SPI mechanism.
This interface is intended to be forward-extensible. If new methods are added, they will include a default implementation.
Implementations of this interface should accommodate the possibility of new methods being added; as a matter of convention,
such methods should begin with the prefix getInitial, which will minimize the possibility of conflict.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final LogContextInitializerThe default log context initializer, which is used when none is specified.static final Handler[]An array containing zero handlers. -
Method Summary
Modifier and TypeMethodDescriptiondefault Handler[]getInitialHandlers(String loggerName) Get the initial set of handlers to configure for the given logger name.default LevelgetInitialLevel(String loggerName) Get the initial level for the given logger name.default LevelgetMinimumLevel(String loggerName) Get the minimum (most verbose) level allowed for the given logger name.default booleanEstablish whether strong references should be used for logger nodes.
-
Field Details
-
NO_HANDLERS
An array containing zero handlers. -
DEFAULT
The default log context initializer, which is used when none is specified. This instance uses only default implementations for all the given methods.
-
-
Method Details
-
getInitialLevel
Get the initial level for the given logger name. If the initializer returns anulllevel for the root logger, then a level ofINFOwill be used.The default implementation returns
null.- Parameters:
loggerName- the logger name (must not benull)- Returns:
- the level to use, or
nullto inherit the level from the parent
-
getMinimumLevel
Get the minimum (most verbose) level allowed for the given logger name. If the initializer returns anulllevel for the root logger, then a level ofALLwill be used.The default implementation returns
null.- Parameters:
loggerName- the logger name (must not benull)- Returns:
- the level to use, or
nullto inherit the level from the parent
-
getInitialHandlers
Get the initial set of handlers to configure for the given logger name.The default implementation returns
NO_HANDLERS. A value ofnullis considered to be the same asNO_HANDLERS.- Parameters:
loggerName- the logger name (must not benull)- Returns:
- the handlers to use (should not be
null)
-
useStrongReferences
default boolean useStrongReferences()Establish whether strong references should be used for logger nodes.- Returns:
trueto use strong references, orfalseto use weak references
-