public final class Logger extends Logger implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Logger.AttachmentKey<V>
An attachment key instance.
|
global, GLOBAL_LOGGER_NAME
Modifier and Type | Method and Description |
---|---|
void |
addHandler(Handler handler) |
<V> V |
attach(Logger.AttachmentKey<V> key,
V value)
Attach an object to this logger under a given key.
|
<V> V |
attachIfAbsent(Logger.AttachmentKey<V> key,
V value)
Attach an object to this logger under a given key, if such an attachment does not already exist.
|
Handler[] |
clearHandlers()
A convenience method to atomically get and clear all handlers.
|
boolean |
compareAndSetHandlers(Handler[] expected,
Handler[] newHandlers)
Atomically compare and set the handler list for this logger.
|
void |
config(String msg) |
<V> V |
detach(Logger.AttachmentKey<V> key)
Remove an attachment.
|
void |
entering(String sourceClass,
String sourceMethod) |
void |
entering(String sourceClass,
String sourceMethod,
Object param1) |
void |
entering(String sourceClass,
String sourceMethod,
Object[] params) |
void |
exiting(String sourceClass,
String sourceMethod) |
void |
exiting(String sourceClass,
String sourceMethod,
Object result) |
protected void |
finalize() |
void |
fine(String msg) |
void |
finer(String msg) |
void |
finest(String msg) |
Handler[] |
getAndSetHandlers(Handler[] handlers)
Atomically get and set the handler list for this logger.
|
<V> V |
getAttachment(Logger.AttachmentKey<V> key)
Get the attachment value for a given key, or
null if there is no such attachment. |
int |
getEffectiveLevel()
Get the effective numerical log level, inherited from the parent.
|
Filter |
getFilter() |
Handler[] |
getHandlers() |
Level |
getLevel() |
LogContext |
getLogContext()
Get the log context to which this logger belongs.
|
static Logger |
getLogger(String name)
Static logger factory method which returns a JBoss LogManager logger.
|
static Logger |
getLogger(String name,
String bundleName)
Static logger factory method which returns a JBoss LogManager logger.
|
Logger |
getParent() |
boolean |
getUseParentHandlers() |
void |
info(String msg) |
boolean |
isLoggable(Level level) |
void |
log(Level level,
String msg) |
void |
log(Level level,
String msg,
Object param1) |
void |
log(Level level,
String msg,
Object[] params) |
void |
log(Level level,
String msg,
Throwable thrown) |
void |
log(LogRecord record) |
void |
log(String fqcn,
Level level,
String message,
ExtLogRecord.FormatStyle style,
Object[] params,
Throwable t)
SPI interface method to log a message at a given level.
|
void |
log(String fqcn,
Level level,
String message,
String bundleName,
ExtLogRecord.FormatStyle style,
Object[] params,
Throwable t)
SPI interface method to log a message at a given level, with a specific resource bundle.
|
void |
log(String fqcn,
Level level,
String message,
Throwable t)
SPI interface method to log a message at a given level.
|
void |
logp(Level level,
String sourceClass,
String sourceMethod,
String msg) |
void |
logp(Level level,
String sourceClass,
String sourceMethod,
String msg,
Object param1) |
void |
logp(Level level,
String sourceClass,
String sourceMethod,
String msg,
Object[] params) |
void |
logp(Level level,
String sourceClass,
String sourceMethod,
String msg,
Throwable thrown) |
void |
logRaw(ExtLogRecord record)
Do the logging with no level checks (they've already been done).
|
void |
logRaw(LogRecord record)
Do the logging with no level checks (they've already been done).
|
void |
logrb(Level level,
String sourceClass,
String sourceMethod,
String bundleName,
String msg) |
void |
logrb(Level level,
String sourceClass,
String sourceMethod,
String bundleName,
String msg,
Object param1) |
void |
logrb(Level level,
String sourceClass,
String sourceMethod,
String bundleName,
String msg,
Object[] params) |
void |
logrb(Level level,
String sourceClass,
String sourceMethod,
String bundleName,
String msg,
Throwable thrown) |
void |
removeHandler(Handler handler) |
void |
setFilter(Filter filter) |
void |
setHandlers(Handler[] handlers)
A convenience method to atomically replace the handler list for this logger.
|
void |
setLevel(Level newLevel)
This implementation grabs a lock, so that only one thread may update the log level of any
logger at a time, in order to allow readers to never block (though there is a window where retrieving the
log level reflects an older effective level than the actual level).
|
void |
setLevelName(String newLevelName)
Set the log level by name.
|
void |
setParent(Logger parent)
Not allowed. This method may never be called.
|
void |
setUseParentHandlers(boolean useParentHandlers) |
void |
severe(String msg) |
void |
throwing(String sourceClass,
String sourceMethod,
Throwable thrown) |
String |
toString() |
void |
warning(String msg) |
protected Object |
writeReplace() |
getAnonymousLogger, getAnonymousLogger, getGlobal, getName, getResourceBundle, getResourceBundleName
public static Logger getLogger(String name)
name
- the logger namepublic static Logger getLogger(String name, String bundleName)
name
- the logger namebundleName
- the bundle nameprotected final Object writeReplace() throws ObjectStreamException
ObjectStreamException
public void setFilter(Filter filter) throws SecurityException
setFilter
in class Logger
SecurityException
public void setLevel(Level newLevel) throws SecurityException
setLevel
in class Logger
SecurityException
public void setLevelName(String newLevelName) throws SecurityException
setLevel(Level)
.newLevelName
- the name of the level to setSecurityException
- if a security manager exists and if the caller does not have LoggingPermission("control")public int getEffectiveLevel()
public boolean isLoggable(Level level)
isLoggable
in class Logger
public <V> V getAttachment(Logger.AttachmentKey<V> key)
null
if there is no such attachment.V
- the attachment value typekey
- the keynull
if there is none for this keypublic <V> V attach(Logger.AttachmentKey<V> key, V value) throws SecurityException
V
- the attachment value typekey
- the attachment keyvalue
- the attachment valueSecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
public <V> V attachIfAbsent(Logger.AttachmentKey<V> key, V value) throws SecurityException
V
- the attachment value typekey
- the attachment keyvalue
- the attachment valuenull
if the value was successfully attachedSecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
public <V> V detach(Logger.AttachmentKey<V> key) throws SecurityException
V
- the attachment value typekey
- the attachment keynull
if there was noneSecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
public void addHandler(Handler handler) throws SecurityException
addHandler
in class Logger
SecurityException
public void removeHandler(Handler handler) throws SecurityException
removeHandler
in class Logger
SecurityException
public Handler[] getHandlers()
getHandlers
in class Logger
public void setHandlers(Handler[] handlers) throws SecurityException
handlers
- the new handlersSecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
public Handler[] getAndSetHandlers(Handler[] handlers) throws SecurityException
handlers
- the new handler setSecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
public boolean compareAndSetHandlers(Handler[] expected, Handler[] newHandlers) throws SecurityException
expected
- the expected list of handlersnewHandlers
- the replacement list of handlerstrue
if the handler list was updated or false
if the current handlers did not match the expected handlers listSecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
public Handler[] clearHandlers() throws SecurityException
SecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
public void setUseParentHandlers(boolean useParentHandlers)
setUseParentHandlers
in class Logger
public boolean getUseParentHandlers()
getUseParentHandlers
in class Logger
public void setParent(Logger parent)
setParent
in class Logger
SecurityException
- alwayspublic LogContext getLogContext()
public void logp(Level level, String sourceClass, String sourceMethod, String msg, Object param1)
public void logp(Level level, String sourceClass, String sourceMethod, String msg, Object[] params)
public void logp(Level level, String sourceClass, String sourceMethod, String msg, Throwable thrown)
public void logrb(Level level, String sourceClass, String sourceMethod, String bundleName, String msg)
public void logrb(Level level, String sourceClass, String sourceMethod, String bundleName, String msg, Object param1)
public void logrb(Level level, String sourceClass, String sourceMethod, String bundleName, String msg, Object[] params)
public void logrb(Level level, String sourceClass, String sourceMethod, String bundleName, String msg, Throwable thrown)
public void log(String fqcn, Level level, String message, String bundleName, ExtLogRecord.FormatStyle style, Object[] params, Throwable t)
fqcn
- the fully qualified class name of the first logger classlevel
- the level to log atmessage
- the messagebundleName
- the resource bundle namestyle
- the message format styleparams
- the log parameterst
- the throwable, if anypublic void log(String fqcn, Level level, String message, ExtLogRecord.FormatStyle style, Object[] params, Throwable t)
fqcn
- the fully qualified class name of the first logger classlevel
- the level to log atmessage
- the messagestyle
- the message format styleparams
- the log parameterst
- the throwable, if anypublic void log(String fqcn, Level level, String message, Throwable t)
fqcn
- the fully qualified class name of the first logger classlevel
- the level to log atmessage
- the messaget
- the throwable, if anypublic void logRaw(ExtLogRecord record)
record
- the extended log recordpublic void logRaw(LogRecord record)
record
- the log recordCopyright © 2018 JBoss by Red Hat. All rights reserved.