|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.logging.log4j.spi.AbstractLoggerAdapter<L>
L
- the Logger class to adaptpublic abstract class AbstractLoggerAdapter<L>
Provides an abstract base class to use for implementing LoggerAdapter.
Field Summary | |
---|---|
protected Map<LoggerContext,ConcurrentMap<String,L>> |
registry
A map to store loggers for their given LoggerContexts. |
Constructor Summary | |
---|---|
AbstractLoggerAdapter()
|
Method Summary | |
---|---|
void |
close()
|
protected abstract LoggerContext |
getContext()
Gets the LoggerContext that should be used to look up or create loggers. |
protected LoggerContext |
getContext(Class<?> callerClass)
Gets the LoggerContext associated with the given caller class. |
L |
getLogger(String name)
Gets a named logger. |
ConcurrentMap<String,L> |
getLoggersInContext(LoggerContext context)
Gets or creates the ConcurrentMap of named loggers for a given LoggerContext. |
protected abstract L |
newLogger(String name,
LoggerContext context)
Creates a new named logger for a given LoggerContext . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Map<LoggerContext,ConcurrentMap<String,L>> registry
Constructor Detail |
---|
public AbstractLoggerAdapter()
Method Detail |
---|
public L getLogger(String name)
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(String name, LoggerContext context)
LoggerContext
.
name
- the name of the logger to createcontext
- the LoggerContext this logger will be associated with
protected abstract LoggerContext getContext()
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 LoggerContext getContext(Class<?> callerClass)
LoggerContext
associated with the given caller class.
callerClass
- the caller class
public void close()
close
in interface Closeable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.