@ProviderType public interface LoggerContext
Any change to the configuration of this Logger Context must be effective immediately for all loggers that would rely upon the configuration of this Logger Context.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
LOGGER_CONTEXT_DEFAULT_LOGLEVEL
Framework launching property specifying the default log level of the root
Logger Context.
|
static java.lang.String |
LOGGER_CONTEXT_PID
Logger Context PID.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Clear the configuration of this Logger Context.
|
LogLevel |
getEffectiveLogLevel(java.lang.String name)
Returns the effective log level of the logger name in this Logger
Context.
|
java.util.Map<java.lang.String,LogLevel> |
getLogLevels()
Returns the configured log levels for this Logger Context.
|
java.lang.String |
getName()
Returns the name for this Logger Context.
|
boolean |
isEmpty()
Returns whether the configuration of this Logger Context is empty.
|
void |
setLogLevels(java.util.Map<java.lang.String,LogLevel> logLevels)
Configure the log levels for this Logger Context.
|
static final java.lang.String LOGGER_CONTEXT_PID
If Configuration Admin is present, Logger Context configuration information in Configuration Admin must be used. The name of the Logger Context is mapped to a Configuration Admin targeted PID as follows:
org.osgi.service.log.admin
.org.osgi.service.log.admin
followed by
vertical line ('|'
\u007c). For example, the Logger Context
named com.foo.bar
is mapped to the targeted PID
org.osgi.service.log.admin|com.foo.bar
.static final java.lang.String LOGGER_CONTEXT_DEFAULT_LOGLEVEL
The value of this property must be the name of the one of the
LogLevel
s.
If not specified, or the specified value is not the name of the one of
the LogLevel
s, the default log level of the root Logger Context
is LogLevel.WARN
.
LogLevel
,
Constant Field Valuesjava.lang.String getName()
null
.LogLevel getEffectiveLogLevel(java.lang.String name)
The effective log level for a logger name is found by the following steps:
default log level of the root
Logger Context
.name
- The logger name.java.util.Map<java.lang.String,LogLevel> getLogLevels()
setLogLevels(Map)
. The returned map must support all
optional Map operations.void setLogLevels(java.util.Map<java.lang.String,LogLevel> logLevels)
All previous log levels configured for this Logger Context are cleared and then the log levels in the specified map are configured.
The configured log levels for this Logger Context can be set by both this method and by configuration information in Configuration Admin, if Configuration Admin is present. The configured log levels for this Logger Context are based upon the last technique used to update the configured log levels. This method must not modify or set configuration information in Configuration Admin.
logLevels
- The log levels to configure for this Logger Context. The
keys are the logger names and the values are the log levels.
The specified map is the property of the caller and this
method must not modify or retain the specified map.void clear()
The configured log levels will be cleared.
boolean isEmpty()
true
if this Logger Context has no configuration. That
is, the configured log levels are empty. Otherwise false
is returned.Copyright © OSGi Alliance (2000, 2018). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0