public final class CallerClassLoaderLogContextSelector extends Object implements LogContextSelector
null
classloader will be the
class loader used.Constructor and Description |
---|
CallerClassLoaderLogContextSelector()
Construct a new instance.
|
CallerClassLoaderLogContextSelector(boolean checkParentClassLoaders)
Construct a new instance.
|
CallerClassLoaderLogContextSelector(LogContextSelector defaultSelector)
Construct a new instance.
|
CallerClassLoaderLogContextSelector(LogContextSelector defaultSelector,
boolean checkParentClassLoaders)
Construct a new instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addLogApiClassLoader(ClassLoader apiClassLoader)
Register a class loader which is a known log API, and thus should be skipped over when searching for the
log context to use for the caller class.
|
LogContext |
getLogContext()
Get the current log context.
|
void |
registerLogContext(ClassLoader classLoader,
LogContext logContext)
Register a class loader with a log context.
|
boolean |
removeLogApiClassLoader(ClassLoader apiClassLoader)
Remove a class loader from the known log APIs set.
|
boolean |
unregisterLogContext(ClassLoader classLoader,
LogContext logContext)
Unregister a class loader/log context association.
|
public CallerClassLoaderLogContextSelector(LogContextSelector defaultSelector)
defaultSelector
- the selector to consult if no matching log context is foundpublic CallerClassLoaderLogContextSelector(LogContextSelector defaultSelector, boolean checkParentClassLoaders)
If the checkParentClassLoaders
is set to true
this selector recursively searches the class loader
parents until a match is found or a null
parent is found.
defaultSelector
- the selector to consult if no matching log context is foundcheckParentClassLoaders
- true
if the log context
could not
found for the class loader and the parent class
loader
should be checkedpublic CallerClassLoaderLogContextSelector()
public CallerClassLoaderLogContextSelector(boolean checkParentClassLoaders)
If the checkParentClassLoaders
is set to true
this selector recursively searches the class loader
parents until a match is found or a null
parent is found.
checkParentClassLoaders
- true
if the log context
could not
found for the class loader and the parent class
loader
should be checkedpublic LogContext getLogContext()
getLogContext
in interface LogContextSelector
public boolean addLogApiClassLoader(ClassLoader apiClassLoader)
apiClassLoader
- the API class loadertrue
if this class loader was previously unknown, or false
if it was already registeredpublic boolean removeLogApiClassLoader(ClassLoader apiClassLoader)
apiClassLoader
- the API class loadertrue
if the class loader was removed, or false
if it was not known to this selectorpublic void registerLogContext(ClassLoader classLoader, LogContext logContext) throws IllegalArgumentException
registerLogContext
RuntimePermission
.classLoader
- the classloaderlogContext
- the log contextIllegalArgumentException
- if the classloader is already associated with a log contextpublic boolean unregisterLogContext(ClassLoader classLoader, LogContext logContext)
unregisterLogContext
RuntimePermission
.classLoader
- the classloaderlogContext
- the log contexttrue
if the association exists and was removed, false
otherwiseCopyright © 2021 JBoss by Red Hat. All rights reserved.