Top Description Fields Constructors Methods
org.jboss.logmanager

pack-priv final Class LoggerNode

extends Object
implements AutoCloseable
Class Inheritance
All Implemented Interfaces
java.lang.AutoCloseable
Imports
java.lang.invoke.ConstantBootstraps, .MethodHandles, .VarHandle, java.lang.reflect.UndeclaredThrowableException, java.security.AccessController, .PrivilegedAction, java.util.Collection, .Enumeration, .HashMap, .Iterator, .Map, .Objects, .Set, java.util.concurrent.ConcurrentHashMap, .ConcurrentMap, java.util.concurrent.atomic.AtomicReferenceFieldUpdater, java.util.concurrent.locks.ReentrantLock, java.util.logging.ErrorManager, .Filter, .Handler, .Level, io.smallrye.common.constraint.Assert, io.smallrye.common.ref.PhantomReference, .Reaper, .Reference

A node in the tree of logger names. Maintains weak references to children and a strong reference to its parent.

Field Summary

Modifier and TypeField and Description
private final Set<Reference<Logger, LoggerNode>>
activeLoggers

The set of phantom references to active loggers.

private static final VarHandle
private volatile Map<Logger.AttachmentKey<?>, Object>
private final ConcurrentMap<String, LoggerNode>
children

The map of names to child nodes.

private final LogContext
context

The log context.

private volatile int
effectiveLevel

The effective level.

private final int
effectiveMinLevel

The effective minimum level, which may not be modified.

private static final StackTraceElement[]
private volatile Filter
filter

The filter for this logger instance.

private final String
fullName

The fully-qualified name of this logger.

private volatile Handler[]
handlers

The handlers for this logger.

private static final AtomicArray<LoggerNode, Handler>
handlersUpdater

The atomic updater for the handlers field.

private volatile Level
level

The actual level.

private final LoggerNode
parent

The parent node, or null if this is the root logger node.

private static final Reaper<Logger, LoggerNode>
private volatile boolean
useParentFilter

Flag to specify whether parent filters are used.

private volatile boolean
useParentHandlers

Flag to specify whether parent handlers are used.

Constructor Summary

AccessConstructor and Description
pack-priv
LoggerNode(final LogContext
the logmanager
context
)

Construct a new root instance.

private
LoggerNode(LogContext
the logmanager
context
,
LoggerNode
the parent node
parent
,
String
the name of this subnode
nodeName
)

Construct a child instance.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addHandler(final Handler handler)

pack-priv <V> V
attach(final Logger.AttachmentKey<V> key, final V value)

pack-priv <V> V
attachIfAbsent(final Logger.AttachmentKey<V> key, final V value)

pack-priv Handler[]
public void
close()

Implements java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources.

pack-priv boolean
compareAndSetHandlers(final Handler[] oldHandlers, final Handler[] newHandlers)

pack-priv Logger
public <V> V
detach(final Logger.AttachmentKey<V> key)

pack-priv <V> V
pack-priv Collection<LoggerNode>

Returns:

the children
getChildren
()

Get the children of this logger.

pack-priv LogContext

Returns:

the log context
getContext
()

Get the log context.

pack-priv int
pack-priv Filter
pack-priv String
pack-priv Handler[]
pack-priv LoggerNode

Returns:

the corresponding logger
getIfExists
(final String
the name
name
)

Get a relative logger, if it exists.

pack-priv Level
pack-priv Enumeration<String>
pack-priv LoggerNode

Returns:

the corresponding logger node
getOrCreate
(final String
the name
name
)

Get or create a relative logger node.

pack-priv LoggerNode
pack-priv boolean
pack-priv boolean
pack-priv boolean

Returns:

true if the record is loggable, otherwise false
isLoggable
(final ExtLogRecord
the log record to check against the filter
record
)

Checks the filter to see if the record is loggable.

private static boolean
isLoggable(final LoggerNode loggerNode, final ExtLogRecord record)

pack-priv boolean
isLoggableLevel(int level)

pack-priv void
publish(final ExtLogRecord record)

pack-priv void
removeHandler(final Handler handler)

pack-priv static Handler[]
safeCloneHandlers(Handler... initialHandlers)

pack-priv void
setEffectiveLevel(int
the new effective level
newLevel
)

Update the effective level if it is inherited from a parent.

pack-priv void
setFilter(final Filter filter)

pack-priv Handler[]
setHandlers(final Handler[] handlers)

pack-priv void
setLevel(final Level newLevel)

pack-priv void
setUseParentFilters(final boolean useParentFilter)

pack-priv void
setUseParentHandlers(final boolean useParentHandlers)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

activeLoggersback to summary
private final Set<Reference<Logger, LoggerNode>> activeLoggers

The set of phantom references to active loggers.

attachmentHandleback to summary
private static final VarHandle attachmentHandle
attachmentsback to summary
private volatile Map<Logger.AttachmentKey<?>, Object> attachments
childrenback to summary
private final ConcurrentMap<String, LoggerNode> children

The map of names to child nodes. The child node references are weak.

contextback to summary
private final LogContext context

The log context.

effectiveLevelback to summary
private volatile int effectiveLevel

The 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.

effectiveMinLevelback to summary
private final int effectiveMinLevel

The effective minimum level, which may not be modified.

EMPTY_STACKback to summary
private static final StackTraceElement[] EMPTY_STACK
filterback to summary
private volatile Filter filter

The filter for this logger instance.

fullNameback to summary
private final String fullName

The fully-qualified name of this logger.

handlersback to summary
private volatile Handler[] handlers

The handlers for this logger. May only be updated using the handlersUpdater atomic updater. The array instance should not be modified (treat as immutable).

Annotations
@SuppressWarnings:UnusedDeclaration
handlersUpdaterback to summary
private static final AtomicArray<LoggerNode, Handler> handlersUpdater

The atomic updater for the handlers field.

levelback to summary
private volatile Level 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.

parentback to summary
private final LoggerNode parent

The parent node, or null if this is the root logger node.

REAPERback to summary
private static final Reaper<Logger, LoggerNode> REAPER
useParentFilterback to summary
private volatile boolean useParentFilter

Flag to specify whether parent filters are used.

useParentHandlersback to summary
private volatile boolean useParentHandlers

Flag to specify whether parent handlers are used.

Constructor Detail

LoggerNodeback to summary
pack-priv LoggerNode(final LogContext context)

Construct a new root instance.

Parameters
context:LogContext

the logmanager

LoggerNodeback to summary
private LoggerNode(LogContext context, LoggerNode parent, String nodeName)

Construct a child instance.

Parameters
context:LogContext

the logmanager

parent:LoggerNode

the parent node

nodeName:String

the name of this subnode

Method Detail

addHandlerback to summary
pack-priv void addHandler(final Handler handler)
attachback to summary
pack-priv <V> V attach(final Logger.AttachmentKey<V> key, final V value)
Annotations
@SuppressWarnings:unchecked
attachIfAbsentback to summary
pack-priv <V> V attachIfAbsent(final Logger.AttachmentKey<V> key, final V value)
Annotations
@SuppressWarnings:unchecked
clearHandlersback to summary
pack-priv Handler[] clearHandlers()
closeback to summary
public void close()

Implements java.lang.AutoCloseable.close.

Doc from java.lang.AutoCloseable.close.

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.

Annotations
@Override
compareAndSetHandlersback to summary
pack-priv boolean compareAndSetHandlers(final Handler[] oldHandlers, final Handler[] newHandlers)
createLoggerback to summary
pack-priv Logger createLogger()
detachback to summary
public <V> V detach(final Logger.AttachmentKey<V> key)
Annotations
@SuppressWarnings:unchecked
getAttachmentback to summary
pack-priv <V> V getAttachment(final Logger.AttachmentKey<V> key)
Annotations
@SuppressWarnings:unchecked
getChildrenback to summary
pack-priv Collection<LoggerNode> getChildren()

Get the children of this logger.

Returns:Collection<LoggerNode>

the children

getContextback to summary
pack-priv LogContext getContext()

Get the log context.

Returns:LogContext

the log context

getEffectiveLevelback to summary
pack-priv int getEffectiveLevel()
getFilterback to summary
pack-priv Filter getFilter()
getFullNameback to summary
pack-priv String getFullName()
getHandlersback to summary
pack-priv Handler[] getHandlers()
getIfExistsback to summary
pack-priv LoggerNode getIfExists(final String name)

Get a relative logger, if it exists.

Parameters
name:String

the name

Returns:LoggerNode

the corresponding logger

getLevelback to summary
pack-priv Level getLevel()
getLoggerNamesback to summary
pack-priv Enumeration<String> getLoggerNames()
getOrCreateback to summary
pack-priv LoggerNode getOrCreate(final String name)

Get or create a relative logger node. The name is relatively qualified to this node.

Parameters
name:String

the name

Returns:LoggerNode

the corresponding logger node

getParentback to summary
pack-priv LoggerNode getParent()
getUseParentFiltersback to summary
pack-priv boolean getUseParentFilters()
getUseParentHandlersback to summary
pack-priv boolean getUseParentHandlers()
isLoggableback to summary
pack-priv boolean isLoggable(final ExtLogRecord record)

Checks the filter to see if the record is loggable. If the getUseParentFilters() is set to true the parent loggers are checked.

Parameters
record:ExtLogRecord

the log record to check against the filter

Returns:boolean

true if the record is loggable, otherwise false

isLoggableback to summary
private static boolean isLoggable(final LoggerNode loggerNode, final ExtLogRecord record)
isLoggableLevelback to summary
pack-priv boolean isLoggableLevel(int level)
publishback to summary
pack-priv void publish(final ExtLogRecord record)
Annotations
@SuppressWarnings:deprecation
removeHandlerback to summary
pack-priv void removeHandler(final Handler handler)
safeCloneHandlersback to summary
pack-priv static Handler[] safeCloneHandlers(Handler... initialHandlers)
setEffectiveLevelback to summary
pack-priv 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:int

the new effective level

setFilterback to summary
pack-priv void setFilter(final Filter filter)
setHandlersback to summary
pack-priv Handler[] setHandlers(final Handler[] handlers)
setLevelback to summary
pack-priv void setLevel(final Level newLevel)
setUseParentFiltersback to summary
pack-priv void setUseParentFilters(final boolean useParentFilter)
setUseParentHandlersback to summary
pack-priv void setUseParentHandlers(final boolean useParentHandlers)