public final class Logger
extends java.util.logging.Logger
implements java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Logger.AttachmentKey<V>
An attachment key instance.
|
Modifier and Type | Field and Description |
---|---|
(package private) static int |
CONFIG_INT |
(package private) static int |
FINE_INT |
(package private) static int |
FINER_INT |
(package private) static int |
FINEST_INT |
(package private) static int |
INFO_INT |
private static java.lang.String |
LOGGER_CLASS_NAME |
private LoggerNode |
loggerNode
The named logger tree node.
|
(package private) static int |
OFF_INT |
private static long |
serialVersionUID |
(package private) static int |
SEVERE_INT |
(package private) static int |
WARNING_INT |
Constructor and Description |
---|
Logger(LoggerNode loggerNode,
java.lang.String name)
Construct a new instance of an actual logger.
|
Modifier and Type | Method and Description |
---|---|
void |
addHandler(java.util.logging.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.
|
java.util.logging.Handler[] |
clearHandlers()
A convenience method to atomically get and clear all handlers.
|
boolean |
compareAndSetHandlers(java.util.logging.Handler[] expected,
java.util.logging.Handler[] newHandlers)
Atomically compare and set the handler list for this logger.
|
void |
config(java.lang.String msg) |
<V> V |
detach(Logger.AttachmentKey<V> key)
Remove an attachment.
|
void |
entering(java.lang.String sourceClass,
java.lang.String sourceMethod) |
void |
entering(java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.Object param1) |
void |
entering(java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.Object[] params) |
void |
exiting(java.lang.String sourceClass,
java.lang.String sourceMethod) |
void |
exiting(java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.Object result) |
protected void |
finalize() |
void |
fine(java.lang.String msg) |
void |
finer(java.lang.String msg) |
void |
finest(java.lang.String msg) |
java.util.logging.Handler[] |
getAndSetHandlers(java.util.logging.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.
|
java.util.logging.Filter |
getFilter() |
java.util.logging.Handler[] |
getHandlers() |
java.util.logging.Level |
getLevel() |
LogContext |
getLogContext()
Get the log context to which this logger belongs.
|
static Logger |
getLogger(java.lang.String name)
Static logger factory method which returns a JBoss LogManager logger.
|
static Logger |
getLogger(java.lang.String name,
java.lang.String bundleName)
Static logger factory method which returns a JBoss LogManager logger.
|
Logger |
getParent() |
boolean |
getUseParentFilters()
Indicates whether or not this logger inherits filters from it's parent logger.
|
boolean |
getUseParentHandlers() |
void |
info(java.lang.String msg) |
boolean |
isLoggable(java.util.logging.Level level) |
void |
log(java.util.logging.Level level,
java.lang.String msg) |
void |
log(java.util.logging.Level level,
java.lang.String msg,
java.lang.Object param1) |
void |
log(java.util.logging.Level level,
java.lang.String msg,
java.lang.Object[] params) |
void |
log(java.util.logging.Level level,
java.lang.String msg,
java.lang.Throwable thrown) |
void |
log(java.util.logging.LogRecord record) |
void |
log(java.lang.String fqcn,
java.util.logging.Level level,
java.lang.String message,
ExtLogRecord.FormatStyle style,
java.lang.Object[] params,
java.lang.Throwable t)
SPI interface method to log a message at a given level.
|
void |
log(java.lang.String fqcn,
java.util.logging.Level level,
java.lang.String message,
java.lang.String bundleName,
ExtLogRecord.FormatStyle style,
java.lang.Object[] params,
java.lang.Throwable t)
SPI interface method to log a message at a given level, with a specific resource bundle.
|
void |
log(java.lang.String fqcn,
java.util.logging.Level level,
java.lang.String message,
java.lang.Throwable t)
SPI interface method to log a message at a given level.
|
void |
logp(java.util.logging.Level level,
java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.String msg) |
void |
logp(java.util.logging.Level level,
java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.String msg,
java.lang.Object param1) |
void |
logp(java.util.logging.Level level,
java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.String msg,
java.lang.Object[] params) |
void |
logp(java.util.logging.Level level,
java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.String msg,
java.lang.Throwable thrown) |
void |
logRaw(ExtLogRecord record)
Do the logging with no level checks (they've already been done).
|
void |
logRaw(java.util.logging.LogRecord record)
Do the logging with no level checks (they've already been done).
|
void |
logrb(java.util.logging.Level level,
java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.String bundleName,
java.lang.String msg) |
void |
logrb(java.util.logging.Level level,
java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.String bundleName,
java.lang.String msg,
java.lang.Object param1) |
void |
logrb(java.util.logging.Level level,
java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.String bundleName,
java.lang.String msg,
java.lang.Object[] params) |
void |
logrb(java.util.logging.Level level,
java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.String bundleName,
java.lang.String msg,
java.lang.Throwable thrown) |
void |
removeHandler(java.util.logging.Handler handler) |
void |
setFilter(java.util.logging.Filter filter) |
void |
setHandlers(java.util.logging.Handler[] handlers)
A convenience method to atomically replace the handler list for this logger.
|
void |
setLevel(java.util.logging.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(java.lang.String newLevelName)
Set the log level by name.
|
void |
setParent(java.util.logging.Logger parent)
Not allowed. This method may never be called.
|
void |
setUseParentFilters(boolean useParentFilter)
Specify whether or not filters should be inherited from parent loggers.
|
void |
setUseParentHandlers(boolean useParentHandlers) |
void |
severe(java.lang.String msg) |
void |
throwing(java.lang.String sourceClass,
java.lang.String sourceMethod,
java.lang.Throwable thrown) |
java.lang.String |
toString() |
void |
warning(java.lang.String msg) |
protected java.lang.Object |
writeReplace() |
private static final long serialVersionUID
private final LoggerNode loggerNode
private static final java.lang.String LOGGER_CLASS_NAME
static final int OFF_INT
static final int SEVERE_INT
static final int WARNING_INT
static final int INFO_INT
static final int CONFIG_INT
static final int FINE_INT
static final int FINER_INT
static final int FINEST_INT
Logger(LoggerNode loggerNode, java.lang.String name)
loggerNode
- the node in the named logger treename
- the fully-qualified name of this nodepublic static Logger getLogger(java.lang.String name)
name
- the logger namepublic static Logger getLogger(java.lang.String name, java.lang.String bundleName)
name
- the logger namebundleName
- the bundle nameprotected final java.lang.Object writeReplace() throws java.io.ObjectStreamException
java.io.ObjectStreamException
public void setFilter(java.util.logging.Filter filter) throws java.lang.SecurityException
setFilter
in class java.util.logging.Logger
java.lang.SecurityException
public java.util.logging.Filter getFilter()
getFilter
in class java.util.logging.Logger
public void setLevel(java.util.logging.Level newLevel) throws java.lang.SecurityException
setLevel
in class java.util.logging.Logger
java.lang.SecurityException
public void setLevelName(java.lang.String newLevelName) throws java.lang.SecurityException
setLevel(Level)
.newLevelName
- the name of the level to setjava.lang.SecurityException
- if a security manager exists and if the caller does not have LoggingPermission("control")public int getEffectiveLevel()
public java.util.logging.Level getLevel()
getLevel
in class java.util.logging.Logger
public boolean isLoggable(java.util.logging.Level level)
isLoggable
in class java.util.logging.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 java.lang.SecurityException
V
- the attachment value typekey
- the attachment keyvalue
- the attachment valuejava.lang.SecurityException
- 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 java.lang.SecurityException
V
- the attachment value typekey
- the attachment keyvalue
- the attachment valuenull
if the value was successfully attachedjava.lang.SecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
public <V> V detach(Logger.AttachmentKey<V> key) throws java.lang.SecurityException
V
- the attachment value typekey
- the attachment keynull
if there was nonejava.lang.SecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
public void addHandler(java.util.logging.Handler handler) throws java.lang.SecurityException
addHandler
in class java.util.logging.Logger
java.lang.SecurityException
public void removeHandler(java.util.logging.Handler handler) throws java.lang.SecurityException
removeHandler
in class java.util.logging.Logger
java.lang.SecurityException
public java.util.logging.Handler[] getHandlers()
getHandlers
in class java.util.logging.Logger
public void setHandlers(java.util.logging.Handler[] handlers) throws java.lang.SecurityException
handlers
- the new handlersjava.lang.SecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
public java.util.logging.Handler[] getAndSetHandlers(java.util.logging.Handler[] handlers) throws java.lang.SecurityException
handlers
- the new handler setjava.lang.SecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
public boolean compareAndSetHandlers(java.util.logging.Handler[] expected, java.util.logging.Handler[] newHandlers) throws java.lang.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 listjava.lang.SecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
public java.util.logging.Handler[] clearHandlers() throws java.lang.SecurityException
java.lang.SecurityException
- if a security manager exists and if the caller does not have LoggingPermission(control)
public void setUseParentHandlers(boolean useParentHandlers)
setUseParentHandlers
in class java.util.logging.Logger
public boolean getUseParentHandlers()
getUseParentHandlers
in class java.util.logging.Logger
public void setUseParentFilters(boolean useParentFilter)
Setting this value to false
has the same behaviour as Logger.
useParentFilter
- true
to inherit a parents filter, otherwise false
public boolean getUseParentFilters()
true
if filters are inherited, otherwise false
public Logger getParent()
getParent
in class java.util.logging.Logger
public void setParent(java.util.logging.Logger parent)
setParent
in class java.util.logging.Logger
java.lang.SecurityException
- alwayspublic LogContext getLogContext()
public void log(java.util.logging.LogRecord record)
log
in class java.util.logging.Logger
public void entering(java.lang.String sourceClass, java.lang.String sourceMethod)
entering
in class java.util.logging.Logger
public void entering(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.Object param1)
entering
in class java.util.logging.Logger
public void entering(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.Object[] params)
entering
in class java.util.logging.Logger
public void exiting(java.lang.String sourceClass, java.lang.String sourceMethod)
exiting
in class java.util.logging.Logger
public void exiting(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.Object result)
exiting
in class java.util.logging.Logger
public void throwing(java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.Throwable thrown)
throwing
in class java.util.logging.Logger
public void severe(java.lang.String msg)
severe
in class java.util.logging.Logger
public void warning(java.lang.String msg)
warning
in class java.util.logging.Logger
public void info(java.lang.String msg)
info
in class java.util.logging.Logger
public void config(java.lang.String msg)
config
in class java.util.logging.Logger
public void fine(java.lang.String msg)
fine
in class java.util.logging.Logger
public void finer(java.lang.String msg)
finer
in class java.util.logging.Logger
public void finest(java.lang.String msg)
finest
in class java.util.logging.Logger
public void log(java.util.logging.Level level, java.lang.String msg)
log
in class java.util.logging.Logger
public void log(java.util.logging.Level level, java.lang.String msg, java.lang.Object param1)
log
in class java.util.logging.Logger
public void log(java.util.logging.Level level, java.lang.String msg, java.lang.Object[] params)
log
in class java.util.logging.Logger
public void log(java.util.logging.Level level, java.lang.String msg, java.lang.Throwable thrown)
log
in class java.util.logging.Logger
public void logp(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg)
logp
in class java.util.logging.Logger
public void logp(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg, java.lang.Object param1)
logp
in class java.util.logging.Logger
public void logp(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg, java.lang.Object[] params)
logp
in class java.util.logging.Logger
public void logp(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String msg, java.lang.Throwable thrown)
logp
in class java.util.logging.Logger
public void logrb(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msg)
logrb
in class java.util.logging.Logger
public void logrb(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msg, java.lang.Object param1)
logrb
in class java.util.logging.Logger
public void logrb(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msg, java.lang.Object[] params)
logrb
in class java.util.logging.Logger
public void logrb(java.util.logging.Level level, java.lang.String sourceClass, java.lang.String sourceMethod, java.lang.String bundleName, java.lang.String msg, java.lang.Throwable thrown)
logrb
in class java.util.logging.Logger
public void log(java.lang.String fqcn, java.util.logging.Level level, java.lang.String message, java.lang.String bundleName, ExtLogRecord.FormatStyle style, java.lang.Object[] params, java.lang.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(java.lang.String fqcn, java.util.logging.Level level, java.lang.String message, ExtLogRecord.FormatStyle style, java.lang.Object[] params, java.lang.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(java.lang.String fqcn, java.util.logging.Level level, java.lang.String message, java.lang.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(java.util.logging.LogRecord record)
record
- the log recordpublic java.lang.String toString()
toString
in class java.lang.Object
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable