public class Logging extends Object
Logger
and
LogManager
offering additional convenience
functions.
If a class keeps a static reference to the appropriate Logging
object, performance penalty compared to standard logging should be minimal.
However when using LogRecord
directly instead of
ELKILogRecord
, the use of the log(LogRecord)
method will
result in incorrectly logged cause location. Therefore, use
ELKILogRecord
!Modifier and Type | Class and Description |
---|---|
static class |
Logging.Level
Logging Level class.
|
Modifier and Type | Field and Description |
---|---|
private Logger |
logger
Wrapped logger of this instance - not static!
|
private static HashMap<String,Logging> |
loggers
HashMap to keep track of loggers.
|
Constructor and Description |
---|
Logging(Logger logger)
Constructor, wrapping a logger.
|
Modifier and Type | Method and Description |
---|---|
void |
debug(CharSequence message)
Log a message at the 'fine' debugging level.
|
void |
debug(CharSequence message,
Throwable e)
Log a message at the 'fine' debugging level.
|
void |
debugFine(CharSequence message)
Log a message at the 'fine' debugging level.
|
void |
debugFine(CharSequence message,
Throwable e)
Log a message at the 'fine' debugging level.
|
void |
debugFiner(CharSequence message)
Log a message at the 'finer' debugging level.
|
void |
debugFiner(CharSequence message,
Throwable e)
Log a message at the 'finer' debugging level.
|
void |
debugFinest(CharSequence message)
Log a message at the 'finest' debugging level.
|
void |
debugFinest(CharSequence message,
Throwable e)
Log a message at the 'finest' debugging level.
|
void |
error(CharSequence message)
Log a message at the 'severe' level.
|
void |
error(CharSequence message,
Throwable e)
Log a message at the 'severe' level.
|
void |
exception(CharSequence message,
Throwable e)
Log a message with exception at the 'severe' level.
|
void |
exception(Throwable e)
Log an exception at the 'severe' level.
|
void |
fine(CharSequence message)
Log a message at the 'fine' debugging level.
|
void |
fine(CharSequence message,
Throwable e)
Log a message at the 'fine' debugging level.
|
void |
finer(CharSequence message)
Log a message at the 'finer' debugging level.
|
void |
finer(CharSequence message,
Throwable e)
Log a message at the 'finer' debugging level.
|
void |
finest(CharSequence message)
Log a message at the 'finest' debugging level.
|
void |
finest(CharSequence message,
Throwable e)
Log a message at the 'finest' debugging level.
|
static Logging |
getLogger(Class<?> c)
Retrieve logging utility for a particular class.
|
static Logging |
getLogger(String name)
Retrieve logging utility for a particular class.
|
void |
info(CharSequence message)
Log a message at the 'info' ('verbose') level.
|
void |
info(CharSequence message,
Throwable e)
Log a message at the 'info' ('verbose') level.
|
boolean |
isDebugging()
Test whether to log 'debug' at 'FINE' level.
|
boolean |
isDebuggingFine()
Test whether to log 'debug' at 'FINE' level
This is the same as
isDebugging() |
boolean |
isDebuggingFiner()
Test whether to log 'debug' at 'FINER' level
|
boolean |
isDebuggingFinest()
Test whether to log 'debug' at 'FINEST' level
|
boolean |
isInfo()
Test whether to log 'info' aka 'verbose'.
|
boolean |
isLoggable(Logging.Level lev)
Verify if logging is enabled at that particular level.
|
boolean |
isStatistics()
Test whether to log 'statistics'.
|
boolean |
isVerbose()
Test whether to log 'verbose' aka 'info'.
|
boolean |
isVeryVerbose()
Test whether to log 'veryverbose'.
|
void |
log(Level level,
CharSequence message)
Log a log message at the given level.
|
void |
log(Level level,
CharSequence message,
Throwable e)
Log a log message and exception at the given level.
|
void |
log(LogRecord rec)
Log a given log record (should be a
ELKILogRecord ) |
Counter |
newCounter(String key)
Generate a new counter.
|
Duration |
newDuration(String key)
Generate a new duration statistic.
|
void |
progress(Progress pgr)
Log a Progress object.
|
void |
statistics(CharSequence message)
Log a message at the 'STATISTICS' level.
|
void |
statistics(CharSequence message,
Throwable e)
Log a message at the 'STATISTICS' level.
|
void |
statistics(Statistic stats)
Log a statistics object.
|
String |
toString() |
void |
verbose(CharSequence message)
Log a message at the 'info' ('verbose') level.
|
void |
verbose(CharSequence message,
Throwable e)
Log a message at the 'info' ('verbose') level.
|
void |
veryverbose(CharSequence message)
Log a message at the 'veryverbose' level.
|
void |
veryverbose(CharSequence message,
Throwable e)
Log a message at the 'veryverbose' level.
|
void |
warning(CharSequence message)
Log a message at the 'warning' level.
|
void |
warning(CharSequence message,
Throwable e)
Log a message at the 'warning' level.
|
private final Logger logger
public Logging(Logger logger)
logger
- Logger to wrap.public static Logging getLogger(Class<?> c)
c
- Class to retrieve logging forpublic static Logging getLogger(String name)
name
- Class namepublic boolean isLoggable(Logging.Level lev)
lev
- Logging levelpublic boolean isStatistics()
public boolean isVerbose()
public boolean isInfo()
public boolean isVeryVerbose()
public boolean isDebugging()
isDebuggingFine()
public boolean isDebuggingFine()
isDebugging()
public boolean isDebuggingFiner()
public boolean isDebuggingFinest()
public void log(Level level, CharSequence message)
level
- Level to log at.message
- Message to log.public void log(Level level, CharSequence message, Throwable e)
level
- Level to log at.message
- Message to log.e
- Exceptionpublic void log(LogRecord rec)
ELKILogRecord
)rec
- Log record to log.public void error(CharSequence message, Throwable e)
message
- Warning log message.e
- Exceptionpublic void error(CharSequence message)
message
- Warning log message.public void warning(CharSequence message, Throwable e)
message
- Warning log message.e
- Exceptionpublic void warning(CharSequence message)
message
- Warning log message.public void statistics(CharSequence message, Throwable e)
message
- Informational log message.e
- Exceptionpublic void statistics(CharSequence message)
message
- Informational log message.public void verbose(CharSequence message, Throwable e)
message
- Informational log message.e
- Exceptionpublic void verbose(CharSequence message)
message
- Informational log message.public void info(CharSequence message, Throwable e)
message
- Informational log message.e
- Exceptionpublic void info(CharSequence message)
message
- Informational log message.public void veryverbose(CharSequence message, Throwable e)
message
- Informational log message.e
- Exceptionpublic void veryverbose(CharSequence message)
message
- Informational log message.public void debug(CharSequence message, Throwable e)
message
- Informational log message.e
- Exceptionpublic void debug(CharSequence message)
message
- Informational log message.public void debugFine(CharSequence message, Throwable e)
message
- Informational log message.e
- Exceptionpublic void debugFine(CharSequence message)
message
- Informational log message.public void fine(CharSequence message, Throwable e)
message
- Informational log message.e
- Exceptionpublic void fine(CharSequence message)
message
- Informational log message.public void debugFiner(CharSequence message, Throwable e)
message
- Informational log message.e
- Exceptionpublic void debugFiner(CharSequence message)
message
- Informational log message.public void finer(CharSequence message, Throwable e)
message
- Informational log message.e
- Exceptionpublic void finer(CharSequence message)
message
- Informational log message.public void debugFinest(CharSequence message, Throwable e)
message
- Informational log message.e
- Exceptionpublic void debugFinest(CharSequence message)
message
- Informational log message.public void finest(CharSequence message, Throwable e)
message
- Informational log message.e
- Exceptionpublic void finest(CharSequence message)
message
- Informational log message.public void exception(CharSequence message, Throwable e)
message
- Error log message.e
- Exceptionpublic void exception(Throwable e)
e
- Exceptionpublic void progress(Progress pgr)
pgr
- Progress to log.public Counter newCounter(String key)
key
- Key to usepublic Duration newDuration(String key)
key
- Key to usepublic void statistics(Statistic stats)
stats
- Statistics object to report.