L - the Logger class to adapt
public abstract class AbstractLoggerAdapter<L> extends Objectimplements LoggerAdapter <L>
| Modifier and Type | Field and Description |
|---|---|
protected Map |
registry
A map to store loggers for their given LoggerContexts.
|
| Constructor and Description |
|---|
AbstractLoggerAdapter()
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
|
protected abstract LoggerContext |
getContext()
Gets the
LoggerContext that should be used to look up or create loggers.
|
protected LoggerContext |
getContext(Class
Gets the
LoggerContext associated with the given caller class.
|
L |
getLogger(String
Gets a named logger.
|
ConcurrentMap |
getLoggersInContext(LoggerContext
Gets or creates the ConcurrentMap of named loggers for a given LoggerContext.
|
protected abstract L |
newLogger(String
Creates a new named logger for a given
LoggerContext.
|
protected final Map<LoggerContext ,ConcurrentMap <String ,L>> registry
public L getLogger(Stringname)
LoggerAdapter
AbstractLoggerAdapter.
getLogger in interface
LoggerAdapter<L>
name - the name of the logger to get
public ConcurrentMap<String ,L> getLoggersInContext(LoggerContext context)
context - the LoggerContext to get loggers for
protected abstract L newLogger(Stringname, LoggerContext context)
LoggerContext.
name - the name of the logger to create
context - the LoggerContext this logger will be associated with
protected abstract LoggerContextgetContext()
LoggerContext that should be used to look up or create loggers. This is similar in spirit to the
ContextSelector class in
log4j-core. However, implementations can rely on their own framework's separation of contexts instead (or simply use a singleton).
LogManager.getContext(ClassLoader, boolean) ,
LogManager.getContext(String, boolean)
protected LoggerContextgetContext(Class <?> callerClass)
LoggerContext associated with the given caller class.
callerClass - the caller class
public void close()