Class LoggerNode
java.lang.Object
org.jboss.logmanager.LoggerNode
A node in the tree of logger names. Maintains weak references to children and a strong reference to its parent.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Map<Logger.AttachmentKey, Object> The attachments map.private static final AtomicReferenceFieldUpdater<LoggerNode, Map> The atomic updater for theattachmentsfield.private final ConcurrentMap<String, LoggerNode> The map of names to child nodes.private final LogContextThe log context.private intThe effective level.private FilterThe filter for this logger instance.private final StringThe fully-qualified name of this logger.private Handler[]The handlers for this logger.private static final AtomicArray<LoggerNode, Handler> The atomic updater for thehandlersfield.private LevelThe actual level.private final LoggerNodeThe parent node, ornullif this is the root logger node.private booleanFlag to specify whether parent filters are used.private booleanFlag to specify whether parent handlers are used. -
Constructor Summary
ConstructorsModifierConstructorDescription(package private)LoggerNode(LogContext context) Construct a new root instance.privateLoggerNode(LogContext context, LoggerNode parent, String nodeName) Construct a child instance. -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddHandler(Handler handler) (package private) <V> Vattach(Logger.AttachmentKey<V> key, V value) (package private) <V> VattachIfAbsent(Logger.AttachmentKey<V> key, V value) (package private) Handler[](package private) booleancompareAndSetHandlers(Handler[] oldHandlers, Handler[] newHandlers) (package private) Logger(package private) voidRemoves one from the reference count.<V> Vdetach(Logger.AttachmentKey<V> key) protected voidfinalize()Perform finalization actions.(package private) <V> VgetAttachment(Logger.AttachmentKey<V> key) (package private) Collection<LoggerNode> Get the children of this logger.(package private) LogContextGet the log context.(package private) int(package private) Filter(package private) String(package private) Handler[](package private) LoggerNodegetIfExists(String name) Get a relative logger, if it exists.(package private) LevelgetLevel()(package private) LoggerNodegetOrCreate(String name) Get or create a relative logger node.(package private) LoggerNode(package private) boolean(package private) boolean(package private) booleanisLoggable(ExtLogRecord record) Checks the filter to see if the record is loggable.private static booleanisLoggable(LoggerNode loggerNode, ExtLogRecord record) (package private) voidpublish(ExtLogRecord record) (package private) voidremoveHandler(Handler handler) (package private) voidsetEffectiveLevel(int newLevel) Update the effective level if it is inherited from a parent.(package private) void(package private) Handler[]setHandlers(Handler[] handlers) (package private) void(package private) voidsetUseParentFilters(boolean useParentFilter) (package private) voidsetUseParentHandlers(boolean useParentHandlers)
-
Field Details
-
context
The log context. -
parent
The parent node, ornullif this is the root logger node. -
fullName
The fully-qualified name of this logger. -
children
The map of names to child nodes. The child node references are weak. -
handlers
The handlers for this logger. May only be updated using thehandlersUpdateratomic updater. The array instance should not be modified (treat as immutable). -
useParentHandlers
private volatile boolean useParentHandlersFlag to specify whether parent handlers are used. -
filter
The filter for this logger instance. -
useParentFilter
private volatile boolean useParentFilterFlag to specify whether parent filters are used. -
attachments
The attachments map. -
handlersUpdater
The atomic updater for thehandlersfield. -
attachmentsUpdater
The atomic updater for theattachmentsfield. -
level
The actual level. May only be modified when the context's level change lock is held; in addition, changing this field must be followed immediately by recursively updating the effective loglevel of the child tree. -
effectiveLevel
private volatile int effectiveLevelThe effective level. May only be modified when the context's level change lock is held; in addition, changing this field must be followed immediately by recursively updating the effective loglevel of the child tree.
-
-
Constructor Details
-
LoggerNode
-
LoggerNode
Construct a child instance.- Parameters:
context- the logmanagerparent- the parent nodenodeName- the name of this subnode
-
-
Method Details
-
getOrCreate
Get or create a relative logger node. The name is relatively qualified to this node.- Parameters:
name- the name- Returns:
- the corresponding logger node
-
getIfExists
Get a relative logger, if it exists.- Parameters:
name- the name- Returns:
- the corresponding logger
-
createLogger
Logger createLogger() -
decrementRef
void decrementRef()Removes one from the reference count. -
getChildren
-
getContext
-
setEffectiveLevel
void setEffectiveLevel(int newLevel) Update the effective level if it is inherited from a parent. Must only be called while the logmanager's level change lock is held.- Parameters:
newLevel- the new effective level
-
setFilter
-
getFilter
Filter getFilter() -
getUseParentFilters
boolean getUseParentFilters() -
setUseParentFilters
void setUseParentFilters(boolean useParentFilter) -
getEffectiveLevel
int getEffectiveLevel() -
getHandlers
Handler[] getHandlers() -
clearHandlers
Handler[] clearHandlers() -
removeHandler
-
addHandler
-
setHandlers
-
compareAndSetHandlers
-
getUseParentHandlers
boolean getUseParentHandlers() -
setUseParentHandlers
void setUseParentHandlers(boolean useParentHandlers) -
publish
-
setLevel
-
getLevel
Level getLevel() -
getAttachment
-
attach
-
attachIfAbsent
-
detach
-
getFullName
String getFullName() -
getParent
LoggerNode getParent() -
isLoggable
Checks the filter to see if the record is loggable. If thegetUseParentFilters()is set totruethe parent loggers are checked.- Parameters:
record- the log record to check against the filter- Returns:
trueif the record is loggable, otherwisefalse
-
isLoggable
-
finalize
Perform finalization actions. This amounts to clearing out the loglevel so that all children are updated with the parent's effective loglevel. As such, a lock is acquired from this method which might cause delays in garbage collection.
-