Package org.jboss.logmanager
Interface LogContextInitializer
-
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
Fields Modifier and Type Field Description static LogContextInitializer
DEFAULT
The default log context initializer, which is used when none is specified.static Handler[]
NO_HANDLERS
An array containing zero handlers.
-
Method Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default Handler[]
getInitialHandlers(String loggerName)
Get the initial set of handlers to configure for the given logger name.default Level
getInitialLevel(String loggerName)
Get the initial level for the given logger name.default Level
getMinimumLevel(String loggerName)
Get the minimum (most verbose) level allowed for the given logger name.default boolean
useStrongReferences()
Establish whether strong references should be used for logger nodes.
-
-
-
Field Detail
-
NO_HANDLERS
static final Handler[] NO_HANDLERS
An array containing zero handlers.
-
DEFAULT
static final LogContextInitializer 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 Detail
-
getInitialLevel
default Level getInitialLevel(String loggerName)
Get the initial level for the given logger name. If the initializer returns anull
level for the root logger, then a level ofINFO
will be used.The default implementation returns
null
.- Parameters:
loggerName
- the logger name (must not benull
)- Returns:
- the level to use, or
null
to inherit the level from the parent
-
getMinimumLevel
default Level getMinimumLevel(String loggerName)
Get the minimum (most verbose) level allowed for the given logger name. If the initializer returns anull
level for the root logger, then a level ofALL
will be used.The default implementation returns
null
.- Parameters:
loggerName
- the logger name (must not benull
)- Returns:
- the level to use, or
null
to inherit the level from the parent
-
getInitialHandlers
default Handler[] getInitialHandlers(String loggerName)
Get the initial set of handlers to configure for the given logger name.The default implementation returns
NO_HANDLERS
. A value ofnull
is 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:
true
to use strong references, orfalse
to use weak references
-
-