public class Logging
extends java.lang.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 java.util.logging.Logger |
logger
Wrapped logger of this instance - not static!
|
private static java.util.HashMap<java.lang.String,Logging> |
loggers
HashMap to keep track of loggers.
|
Constructor and Description |
---|
Logging(java.util.logging.Logger logger)
Constructor, wrapping a logger.
|
Modifier and Type | Method and Description |
---|---|
void |
beginStep(StepProgress prog,
int step,
java.lang.String title)
Begin a new algorithm step (unless
null ). |
void |
debug(java.lang.CharSequence message)
Log a message at the 'fine' debugging level.
|
void |
debug(java.lang.CharSequence message,
java.lang.Throwable e)
Log a message at the 'fine' debugging level.
|
void |
debugFine(java.lang.CharSequence message)
Log a message at the 'fine' debugging level.
|
void |
debugFine(java.lang.CharSequence message,
java.lang.Throwable e)
Log a message at the 'fine' debugging level.
|
void |
debugFiner(java.lang.CharSequence message)
Log a message at the 'finer' debugging level.
|
void |
debugFiner(java.lang.CharSequence message,
java.lang.Throwable e)
Log a message at the 'finer' debugging level.
|
void |
debugFinest(java.lang.CharSequence message)
Log a message at the 'finest' debugging level.
|
void |
debugFinest(java.lang.CharSequence message,
java.lang.Throwable e)
Log a message at the 'finest' debugging level.
|
void |
ensureCompleted(FiniteProgress prog)
Increment a progress (unless
null ). |
void |
error(java.lang.CharSequence message)
Log a message at the 'severe' level.
|
void |
error(java.lang.CharSequence message,
java.lang.Throwable e)
Log a message at the 'severe' level.
|
void |
exception(java.lang.CharSequence message,
java.lang.Throwable e)
Log a message with exception at the 'severe' level.
|
void |
exception(java.lang.Throwable e)
Log an exception at the 'severe' level.
|
void |
fine(java.lang.CharSequence message)
Log a message at the 'fine' debugging level.
|
void |
fine(java.lang.CharSequence message,
java.lang.Throwable e)
Log a message at the 'fine' debugging level.
|
void |
finer(java.lang.CharSequence message)
Log a message at the 'finer' debugging level.
|
void |
finer(java.lang.CharSequence message,
java.lang.Throwable e)
Log a message at the 'finer' debugging level.
|
void |
finest(java.lang.CharSequence message)
Log a message at the 'finest' debugging level.
|
void |
finest(java.lang.CharSequence message,
java.lang.Throwable e)
Log a message at the 'finest' debugging level.
|
static Logging |
getLogger(java.lang.Class<?> c)
Retrieve logging utility for a particular class.
|
static Logging |
getLogger(java.lang.String name)
Retrieve logging utility for a particular class.
|
void |
incrementProcessed(AbstractProgress prog)
Increment a progress (unless
null ). |
void |
info(java.lang.CharSequence message)
Log a message at the 'info' ('verbose') level.
|
void |
info(java.lang.CharSequence message,
java.lang.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(java.util.logging.Level level,
java.lang.CharSequence message)
Log a log message at the given level.
|
void |
log(java.util.logging.Level level,
java.lang.CharSequence message,
java.lang.Throwable e)
Log a log message and exception at the given level.
|
void |
log(java.util.logging.LogRecord rec)
Log a given log record (should be a
ELKILogRecord ) |
Counter |
newCounter(java.lang.String key)
Generate a new counter.
|
Duration |
newDuration(java.lang.String key)
Generate a new duration statistic.
|
void |
progress(Progress pgr)
Log a Progress object.
|
void |
setCompleted(IndefiniteProgress prog)
Finish a progress (unless
null ). |
void |
setCompleted(StepProgress prog)
Finish a progress (unless
null ). |
void |
statistics(java.lang.CharSequence message)
Log a message at the 'STATISTICS' level.
|
void |
statistics(java.lang.CharSequence message,
java.lang.Throwable e)
Log a message at the 'STATISTICS' level.
|
void |
statistics(Statistic stats)
Log a statistics object.
|
java.lang.String |
toString() |
void |
verbose(java.lang.CharSequence message)
Log a message at the 'info' ('verbose') level.
|
void |
verbose(java.lang.CharSequence message,
java.lang.Throwable e)
Log a message at the 'info' ('verbose') level.
|
void |
veryverbose(java.lang.CharSequence message)
Log a message at the 'veryverbose' level.
|
void |
veryverbose(java.lang.CharSequence message,
java.lang.Throwable e)
Log a message at the 'veryverbose' level.
|
void |
warning(java.lang.CharSequence message)
Log a message at the 'warning' level.
|
void |
warning(java.lang.CharSequence message,
java.lang.Throwable e)
Log a message at the 'warning' level.
|
private static java.util.HashMap<java.lang.String,Logging> loggers
private final java.util.logging.Logger logger
public Logging(java.util.logging.Logger logger)
logger
- Logger to wrap.public static Logging getLogger(java.lang.Class<?> c)
c
- Class to retrieve logging forpublic static Logging getLogger(java.lang.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(java.util.logging.Level level, java.lang.CharSequence message)
level
- Level to log at.message
- Message to log.public void log(java.util.logging.Level level, java.lang.CharSequence message, java.lang.Throwable e)
level
- Level to log at.message
- Message to log.e
- Exceptionpublic void log(java.util.logging.LogRecord rec)
ELKILogRecord
)rec
- Log record to log.public void error(java.lang.CharSequence message, java.lang.Throwable e)
message
- Warning log message.e
- Exceptionpublic void error(java.lang.CharSequence message)
message
- Warning log message.public void warning(java.lang.CharSequence message, java.lang.Throwable e)
message
- Warning log message.e
- Exceptionpublic void warning(java.lang.CharSequence message)
message
- Warning log message.public void statistics(java.lang.CharSequence message, java.lang.Throwable e)
message
- Informational log message.e
- Exceptionpublic void statistics(java.lang.CharSequence message)
message
- Informational log message.public void verbose(java.lang.CharSequence message, java.lang.Throwable e)
message
- Informational log message.e
- Exceptionpublic void verbose(java.lang.CharSequence message)
message
- Informational log message.public void info(java.lang.CharSequence message, java.lang.Throwable e)
message
- Informational log message.e
- Exceptionpublic void info(java.lang.CharSequence message)
message
- Informational log message.public void veryverbose(java.lang.CharSequence message, java.lang.Throwable e)
message
- Informational log message.e
- Exceptionpublic void veryverbose(java.lang.CharSequence message)
message
- Informational log message.public void debug(java.lang.CharSequence message, java.lang.Throwable e)
message
- Informational log message.e
- Exceptionpublic void debug(java.lang.CharSequence message)
message
- Informational log message.public void debugFine(java.lang.CharSequence message, java.lang.Throwable e)
message
- Informational log message.e
- Exceptionpublic void debugFine(java.lang.CharSequence message)
message
- Informational log message.public void fine(java.lang.CharSequence message, java.lang.Throwable e)
message
- Informational log message.e
- Exceptionpublic void fine(java.lang.CharSequence message)
message
- Informational log message.public void debugFiner(java.lang.CharSequence message, java.lang.Throwable e)
message
- Informational log message.e
- Exceptionpublic void debugFiner(java.lang.CharSequence message)
message
- Informational log message.public void finer(java.lang.CharSequence message, java.lang.Throwable e)
message
- Informational log message.e
- Exceptionpublic void finer(java.lang.CharSequence message)
message
- Informational log message.public void debugFinest(java.lang.CharSequence message, java.lang.Throwable e)
message
- Informational log message.e
- Exceptionpublic void debugFinest(java.lang.CharSequence message)
message
- Informational log message.public void finest(java.lang.CharSequence message, java.lang.Throwable e)
message
- Informational log message.e
- Exceptionpublic void finest(java.lang.CharSequence message)
message
- Informational log message.public void exception(java.lang.CharSequence message, java.lang.Throwable e)
message
- Error log message.e
- Exceptionpublic void exception(java.lang.Throwable e)
e
- Exceptionpublic void progress(Progress pgr)
pgr
- Progress to log.public Counter newCounter(java.lang.String key)
key
- Key to usepublic Duration newDuration(java.lang.String key)
key
- Key to usepublic void incrementProcessed(AbstractProgress prog)
null
).prog
- Progress to increment, may be null
.public void ensureCompleted(FiniteProgress prog)
null
).prog
- Progress to complete, may be null
.public void beginStep(StepProgress prog, int step, java.lang.String title)
null
).
Important: Do not use this method when the parameter are not static.
In these cases, check whether logging is enabled first, to avoid computing
method parameters!prog
- Progress to increment, may be null
.step
- Step numbertitle
- Step titlepublic void setCompleted(StepProgress prog)
null
).prog
- Progress to complete, may be null
.public void setCompleted(IndefiniteProgress prog)
null
).prog
- Progress to complete, may be null
.public void statistics(Statistic stats)
stats
- Statistics object to report.public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2019 ELKI Development Team. License information.