| Modifier and Type | Class and Description |
|---|---|
| private static class | LogContext.
This lazy holder class is required to prevent a problem due to a LogContext instance being constructed before the class init is complete. |
| Modifier and Type | Field and Description |
|---|---|
| private static final VarHandle | |
| private volatile Map | |
| private final Set | |
| pack-priv static final Permission | |
| pack-priv static final Permission | |
| public static final LogContextSelector | DEFAULT_LOG_CONTEXT_SELECTOR
The default log context selector, which always returns the system log context. |
| private final LogContextInitializer | |
| private final AtomicReference | |
| private static volatile LogContextSelector | |
| private final Set | |
| private final LoggerNode | |
| pack-priv static final Permission | |
| private final boolean | |
| private static final LogContext | |
| pack-priv final ReentrantLock | treeLock
This lock is taken any time a change is made which affects multiple nodes in the hierarchy. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private static SecurityException | |
| public void | addCloseHandler(final AutoCloseable
the close handler to use closeHandler)Adds a handler invoked during the close of this log context. |
| public < the attachment value type V> V | Returns: the old attachment, if there was onethe attachment key key,the attachment value value)Attach an object to this log context under a given key. |
| public < the attachment value type V> V | Returns: the current attachment, if there is one, ornull if the value was successfully attachedthe attachment key key,the attachment value value)Attach an object to this log context under a given key, if such an attachment does not already exist. |
| pack-priv static void | |
| public void | close()
Implements java. Closes this resource, relinquishing any underlying resources. |
| public static LogContext | Returns: a new log contexttrue if the context should use strong references, false to use (default) weak
references for automatic logger GCCreate a new log context. |
| public static LogContext | Returns: a new log contexttrue if the context should use strong references, false to use (default) weak
references for automatic logger GCthe log context initializer to use (must not be initializer)null)Create a new log context. |
| public static LogContext | |
| public static LogContext | Returns: a new log contextthe log context initializer to use (must not be initializer)null)Create a new log context. |
| pack-priv ConcurrentMap | |
| public < the attachment value type V> V | Returns: the old value, ornull if there was nonethe attachment key keyRemove an attachment. |
| private static LogContextInitializer | |
| private static LogContextInitializer | |
| public < the attachment value type V> V | Returns: the attachment, ornull if there is none for this keythe key keyGet the attachment value for a given key, or |
| public < the attachment value type V> V | Returns: the attachment ornull if the logger or the attachment does not existthe logger name loggerName, Logger.the attachment key keyGet a logger attachment for a logger name, if it exists. |
| public Set | Returns: the current close handlersGets the current close handlers associated with this log context. |
| pack-priv LogContextInitializer | |
| public Level | |
| public static LogContext | |
| public static LogContextSelector | Returns: the log context selectorReturns the currently set log context selector. |
| public Logger | |
| public Logger | Returns: the logger instance, ornull if no such logger node existsthe logger name name)Get a logger with the given name from this logging context, if a logger node exists at that location. |
| public Enumeration | Returns: an enumeration of the logger namesReturns an enumeration of the logger names that have been created. |
| pack-priv LoggerNode | |
| public static LogContext | |
| pack-priv boolean | |
| private void | |
| public void | |
| public void | registerLevel(Level
the level to register level, boolean true to strongly reference the level, or false to weakly reference itRegister a level instance with this log context. |
| public void | setCloseHandlers(final Collection<AutoCloseable>
the close handlers to use closeHandlers)Clears any current close handlers associated with log context, then adds the handlers to be invoked during the close of this log context. |
| public static void | setLogContextSelector(LogContextSelector
the new selector. newSelector)Set a new log context selector. |
| pack-priv boolean | |
| public void |
| attachmentHandle | back to summary |
|---|---|
| private static final VarHandle attachmentHandle | |
| attachments | back to summary |
|---|---|
| private volatile Map<Logger. | |
| closeHandlers | back to summary |
|---|---|
| private final Set<AutoCloseable> closeHandlers | |
| CONTROL_PERMISSION | back to summary |
|---|---|
| pack-priv static final Permission CONTROL_PERMISSION | |
| CREATE_CONTEXT_PERMISSION | back to summary |
|---|---|
| pack-priv static final Permission CREATE_CONTEXT_PERMISSION | |
| DEFAULT_LOG_CONTEXT_SELECTOR | back to summary |
|---|---|
| public static final LogContextSelector DEFAULT_LOG_CONTEXT_SELECTOR The default log context selector, which always returns the system log context. | |
| initializer | back to summary |
|---|---|
| private final LogContextInitializer initializer | |
| levelMapReference | back to summary |
|---|---|
| private final AtomicReference<Map<String, Reference<Level, Void>>> levelMapReference | |
| logContextSelector | back to summary |
|---|---|
| private static volatile LogContextSelector logContextSelector | |
| pinnedSet | back to summary |
|---|---|
| private final Set<LoggerNode> pinnedSet | |
| rootLogger | back to summary |
|---|---|
| private final LoggerNode rootLogger | |
| SET_CONTEXT_SELECTOR_PERMISSION | back to summary |
|---|---|
| pack-priv static final Permission SET_CONTEXT_SELECTOR_PERMISSION | |
| strong | back to summary |
|---|---|
| private final boolean strong | |
| SYSTEM_CONTEXT | back to summary |
|---|---|
| private static final LogContext SYSTEM_CONTEXT | |
| treeLock | back to summary |
|---|---|
| pack-priv final ReentrantLock treeLock This lock is taken any time a change is made which affects multiple nodes in the hierarchy. | |
| LogContext | back to summary |
|---|---|
| pack-priv LogContext(final boolean strong, LogContextInitializer initializer) | |
| accessDenied | back to summary |
|---|---|
| private static SecurityException accessDenied() | |
| addCloseHandler | back to summary |
|---|---|
| public void addCloseHandler(final AutoCloseable closeHandler) Adds a handler invoked during the close of this log context. The close handlers will be invoked in the order they are added. The loggers associated with this context will always be closed.
| |
| attach | back to summary |
|---|---|
| public <V> V attach(Logger. Attach an object to this log context under a given key. A strong reference is maintained to the key and value for as long as this log context exists. Log context attachments are placed on the root logger and can also be accessed there.
| |
| attachIfAbsent | back to summary |
|---|---|
| public <V> V attachIfAbsent(Logger. Attach an object to this log context under a given key, if such an attachment does not already exist. A strong reference is maintained to the key and value for as long as this log context exists. Log context attachments are placed on the root logger and can also be accessed there.
| |
| checkAccess | back to summary |
|---|---|
| pack-priv static void checkAccess() | |
| close | back to summary |
|---|---|
| public void close() throws Exception Implements java. Doc from java. Closes this resource, relinquishing any underlying resources.
This method is invoked automatically on objects managed by the
| |
| create | back to summary |
|---|---|
| public static LogContext create(boolean strong) Create a new log context. If a security manager is installed, the caller must have the
| |
| create | back to summary |
|---|---|
| public static LogContext create(boolean strong, LogContextInitializer initializer) Create a new log context. If a security manager is installed, the caller must have the
| |
| create | back to summary |
|---|---|
| public static LogContext create() Create a new log context. If a security manager is installed, the caller must have the
| |
| create | back to summary |
|---|---|
| public static LogContext create(LogContextInitializer initializer) Create a new log context. If a security manager is installed, the caller must have the
| |
| createChildMap | back to summary |
|---|---|
| pack-priv ConcurrentMap | |
| detach | back to summary |
|---|---|
| public <V> V detach(Logger. Remove an attachment. Log context attachments are placed on the root logger and can also be accessed there.
| |
| discoverDefaultInitializer | back to summary |
|---|---|
| private static LogContextInitializer discoverDefaultInitializer() | |
| discoverDefaultInitializer0 | back to summary |
|---|---|
| private static LogContextInitializer discoverDefaultInitializer0() | |
| getAttachment | back to summary |
|---|---|
| public <V> V getAttachment(Logger. Get the attachment value for a given key, or
| |
| getAttachment | back to summary |
|---|---|
| public <V> V getAttachment(String loggerName, Logger. Get a logger attachment for a logger name, if it exists.
| |
| getCloseHandlers | back to summary |
|---|---|
| public Set Gets the current close handlers associated with this log context.
| |
| getInitializer | back to summary |
|---|---|
| pack-priv LogContextInitializer getInitializer() | |
| getLevelForName | back to summary |
|---|---|
| public Level getLevelForName(String name) throws IllegalArgumentException Get the level for a name.
| |
| getLogContext | back to summary |
|---|---|
| public static LogContext getLogContext() Get the currently active log context.
| |
| getLogContextSelector | back to summary |
|---|---|
| public static LogContextSelector getLogContextSelector() Returns the currently set log context selector.
| |
| getLogger | back to summary |
|---|---|
| public Logger getLogger(String name) Get a logger with the given name from this logging context.
| |
| getLoggerIfExists | back to summary |
|---|---|
| public Logger getLoggerIfExists(String name) Get a logger with the given name from this logging context, if a logger node exists at that location. | |
| getLoggerNames | back to summary |
|---|---|
| public Enumeration Returns an enumeration of the logger names that have been created. This does not return names of loggers that may have been garbage collected. Logger names added after the enumeration has been retrieved may also be added to the enumeration.
| |
| getRootLoggerNode | back to summary |
|---|---|
| pack-priv LoggerNode getRootLoggerNode() | |
| getSystemLogContext | back to summary |
|---|---|
| public static LogContext getSystemLogContext() Get the system log context.
| |
| pin | back to summary |
|---|---|
| pack-priv boolean pin(LoggerNode node) | |
| recursivelyClose | back to summary |
|---|---|
| private void recursivelyClose(final LoggerNode loggerNode) | |
| registerLevel | back to summary |
|---|---|
| public void registerLevel(Level level) Register a level instance with this log context. The level can then be looked up by name. Only a weak reference to the level instance will be kept. Any previous level registration for the given level's name will be overwritten.
| |
| registerLevel | back to summary |
|---|---|
| public void registerLevel(Level level, boolean strong) Register a level instance with this log context. The level can then be looked up by name. Any previous level registration for the given level's name will be overwritten.
| |
| setCloseHandlers | back to summary |
|---|---|
| public void setCloseHandlers(final Collection<AutoCloseable> closeHandlers) Clears any current close handlers associated with log context, then adds the handlers to be invoked during the close of this log context. The close handlers will be invoked in the order they are added. The loggers associated with this context will always be closed.
| |
| setLogContextSelector | back to summary |
|---|---|
| public static void setLogContextSelector(LogContextSelector newSelector) Set a new log context selector. If a security manager is installed, the caller must have the
| |
| unpin | back to summary |
|---|---|
| pack-priv boolean unpin(LoggerNode node) | |
| unregisterLevel | back to summary |
|---|---|
| public void unregisterLevel(Level level) Unregister a previously registered level. Log levels that are not registered may still be used, they just will not be findable by name.
| |
| Modifier and Type | Field and Description |
|---|---|
| private static final HashMap |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static void |
| INITIAL_LEVEL_MAP | back to summary |
|---|---|
| private static final HashMap<String, Reference<Level, Void>> INITIAL_LEVEL_MAP | |
| LazyHolder | back to summary |
|---|---|
| private LazyHolder() | |