Package elki.logging
Class Logging
- java.lang.Object
-
- elki.logging.Logging
-
public class Logging extends java.lang.ObjectThis class is a wrapper aroundLoggerandLogManageroffering additional convenience functions. If a class keeps a static reference to the appropriateLoggingobject, performance penalty compared to standard logging should be minimal. However when usingLogRecorddirectly instead ofELKILogRecord, the use of thelog(LogRecord)method will result in incorrectly logged cause location. Therefore, useELKILogRecord!- Since:
- 0.2
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLogging.LevelLogging Level class.
-
Constructor Summary
Constructors Constructor Description Logging(java.util.logging.Logger logger)Constructor, wrapping a logger.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeginStep(StepProgress prog, int step, java.lang.String title)Begin a new algorithm step (unlessnull).voiddebug(java.lang.CharSequence message)Log a message at the 'fine' debugging level.voiddebug(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'fine' debugging level.voiddebugFine(java.lang.CharSequence message)Log a message at the 'fine' debugging level.voiddebugFine(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'fine' debugging level.voiddebugFiner(java.lang.CharSequence message)Log a message at the 'finer' debugging level.voiddebugFiner(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'finer' debugging level.voiddebugFinest(java.lang.CharSequence message)Log a message at the 'finest' debugging level.voiddebugFinest(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'finest' debugging level.voidensureCompleted(FiniteProgress prog)Increment a progress (unlessnull).voiderror(java.lang.CharSequence message)Log a message at the 'severe' level.voiderror(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'severe' level.voidexception(java.lang.CharSequence message, java.lang.Throwable e)Log a message with exception at the 'severe' level.voidexception(java.lang.Throwable e)Log an exception at the 'severe' level.voidfine(java.lang.CharSequence message)Log a message at the 'fine' debugging level.voidfine(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'fine' debugging level.voidfiner(java.lang.CharSequence message)Log a message at the 'finer' debugging level.voidfiner(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'finer' debugging level.voidfinest(java.lang.CharSequence message)Log a message at the 'finest' debugging level.voidfinest(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'finest' debugging level.static LogginggetLogger(java.lang.Class<?> c)Retrieve logging utility for a particular class.static LogginggetLogger(java.lang.String name)Retrieve logging utility for a particular class.voidincrementProcessed(AbstractProgress prog)Increment a progress (unlessnull).voidinfo(java.lang.CharSequence message)Log a message at the 'info' ('verbose') level.voidinfo(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'info' ('verbose') level.booleanisDebugging()Test whether to log 'debug' at 'FINE' level.booleanisDebuggingFine()Test whether to log 'debug' at 'FINE' level This is the same asisDebugging()booleanisDebuggingFiner()Test whether to log 'debug' at 'FINER' levelbooleanisDebuggingFinest()Test whether to log 'debug' at 'FINEST' levelbooleanisInfo()Test whether to log 'info' aka 'verbose'.booleanisLoggable(java.util.logging.Level lev)Verify if logging is enabled at that particular level.booleanisStatistics()Test whether to log 'statistics'.booleanisVerbose()Test whether to log 'verbose' aka 'info'.booleanisVeryVerbose()Test whether to log 'veryverbose'.voidlog(java.util.logging.Level level, java.lang.CharSequence message)Log a log message at the given level.voidlog(java.util.logging.Level level, java.lang.CharSequence message, java.lang.Throwable e)Log a log message and exception at the given level.voidlog(java.util.logging.LogRecord rec)Log a given log record (should be aELKILogRecord)CounternewCounter(java.lang.String key)Generate a new counter.DurationnewDuration(java.lang.String key)Generate a new duration statistic.voidprogress(Progress pgr)Log a Progress object.voidsetCompleted(IndefiniteProgress prog)Finish a progress (unlessnull).voidsetCompleted(StepProgress prog)Finish a progress (unlessnull).voidstatistics(Statistic stats)Log a statistics object.voidstatistics(java.lang.CharSequence message)Log a message at the 'STATISTICS' level.voidstatistics(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'STATISTICS' level.java.lang.StringtoString()voidverbose(java.lang.CharSequence message)Log a message at the 'info' ('verbose') level.voidverbose(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'info' ('verbose') level.voidveryverbose(java.lang.CharSequence message)Log a message at the 'veryverbose' level.voidveryverbose(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'veryverbose' level.voidwarning(java.lang.CharSequence message)Log a message at the 'warning' level.voidwarning(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'warning' level.
-
-
-
Field Detail
-
loggers
private static java.util.HashMap<java.lang.String,Logging> loggers
HashMap to keep track of loggers.
-
logger
private final java.util.logging.Logger logger
Wrapped logger of this instance - not static!
-
-
Method Detail
-
getLogger
public static Logging getLogger(java.lang.Class<?> c)
Retrieve logging utility for a particular class.- Parameters:
c- Class to retrieve logging for- Returns:
- Logger
-
getLogger
public static Logging getLogger(java.lang.String name)
Retrieve logging utility for a particular class.- Parameters:
name- Class name- Returns:
- Logger
-
isLoggable
public boolean isLoggable(java.util.logging.Level lev)
Verify if logging is enabled at that particular level.- Parameters:
lev- Logging level- Returns:
- status
-
isStatistics
public boolean isStatistics()
Test whether to log 'statistics'.- Returns:
- true if logging statistics
-
isVerbose
public boolean isVerbose()
Test whether to log 'verbose' aka 'info'.- Returns:
- true if verbose
-
isInfo
public boolean isInfo()
Test whether to log 'info' aka 'verbose'.- Returns:
- true if verbose
-
isVeryVerbose
public boolean isVeryVerbose()
Test whether to log 'veryverbose'.- Returns:
- true if extra verbose
-
isDebugging
public boolean isDebugging()
Test whether to log 'debug' at 'FINE' level. This is the same asisDebuggingFine()- Returns:
- true if debug logging enabled
-
isDebuggingFine
public boolean isDebuggingFine()
Test whether to log 'debug' at 'FINE' level This is the same asisDebugging()- Returns:
- true if debug logging enabled
-
isDebuggingFiner
public boolean isDebuggingFiner()
Test whether to log 'debug' at 'FINER' level- Returns:
- true if debug logging enabled
-
isDebuggingFinest
public boolean isDebuggingFinest()
Test whether to log 'debug' at 'FINEST' level- Returns:
- true if debug logging enabled
-
log
public void log(java.util.logging.Level level, java.lang.CharSequence message)Log a log message at the given level.- Parameters:
level- Level to log at.message- Message to log.
-
log
public 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.- Parameters:
level- Level to log at.message- Message to log.e- Exception
-
log
public void log(java.util.logging.LogRecord rec)
Log a given log record (should be aELKILogRecord)- Parameters:
rec- Log record to log.
-
error
public void error(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'severe' level.- Parameters:
message- Warning log message.e- Exception
-
error
public void error(java.lang.CharSequence message)
Log a message at the 'severe' level.- Parameters:
message- Warning log message.
-
warning
public void warning(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'warning' level.- Parameters:
message- Warning log message.e- Exception
-
warning
public void warning(java.lang.CharSequence message)
Log a message at the 'warning' level.- Parameters:
message- Warning log message.
-
statistics
public void statistics(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'STATISTICS' level. You should check isTime() before building the message.- Parameters:
message- Informational log message.e- Exception
-
statistics
public void statistics(java.lang.CharSequence message)
Log a message at the 'STATISTICS' level. You should check isTime() before building the message.- Parameters:
message- Informational log message.
-
verbose
public void verbose(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'info' ('verbose') level. You should check isVerbose() before building the message.- Parameters:
message- Informational log message.e- Exception
-
verbose
public void verbose(java.lang.CharSequence message)
Log a message at the 'info' ('verbose') level. You should check isVerbose() before building the message.- Parameters:
message- Informational log message.
-
info
public void info(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'info' ('verbose') level. You should check isVerbose() before building the message.- Parameters:
message- Informational log message.e- Exception
-
info
public void info(java.lang.CharSequence message)
Log a message at the 'info' ('verbose') level. You should check isVerbose() before building the message.- Parameters:
message- Informational log message.
-
veryverbose
public void veryverbose(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'veryverbose' level. You should check isVeryVerbose() before building the message.- Parameters:
message- Informational log message.e- Exception
-
veryverbose
public void veryverbose(java.lang.CharSequence message)
Log a message at the 'veryverbose' level. You should check isVeryVerbose() before building the message.- Parameters:
message- Informational log message.
-
debug
public void debug(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'fine' debugging level. You should check isDebugging() before building the message.- Parameters:
message- Informational log message.e- Exception
-
debug
public void debug(java.lang.CharSequence message)
Log a message at the 'fine' debugging level. You should check isDebugging() before building the message.- Parameters:
message- Informational log message.
-
debugFine
public void debugFine(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'fine' debugging level. You should check isDebugging() before building the message.- Parameters:
message- Informational log message.e- Exception
-
debugFine
public void debugFine(java.lang.CharSequence message)
Log a message at the 'fine' debugging level. You should check isDebugging() before building the message.- Parameters:
message- Informational log message.
-
fine
public void fine(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'fine' debugging level. You should check isDebugging() before building the message.- Parameters:
message- Informational log message.e- Exception
-
fine
public void fine(java.lang.CharSequence message)
Log a message at the 'fine' debugging level. You should check isDebugging() before building the message.- Parameters:
message- Informational log message.
-
debugFiner
public void debugFiner(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'finer' debugging level. You should check isDebugging() before building the message.- Parameters:
message- Informational log message.e- Exception
-
debugFiner
public void debugFiner(java.lang.CharSequence message)
Log a message at the 'finer' debugging level. You should check isDebugging() before building the message.- Parameters:
message- Informational log message.
-
finer
public void finer(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'finer' debugging level. You should check isDebugging() before building the message.- Parameters:
message- Informational log message.e- Exception
-
finer
public void finer(java.lang.CharSequence message)
Log a message at the 'finer' debugging level. You should check isDebugging() before building the message.- Parameters:
message- Informational log message.
-
debugFinest
public void debugFinest(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'finest' debugging level. You should check isDebugging() before building the message.- Parameters:
message- Informational log message.e- Exception
-
debugFinest
public void debugFinest(java.lang.CharSequence message)
Log a message at the 'finest' debugging level. You should check isDebugging() before building the message.- Parameters:
message- Informational log message.
-
finest
public void finest(java.lang.CharSequence message, java.lang.Throwable e)Log a message at the 'finest' debugging level. You should check isDebugging() before building the message.- Parameters:
message- Informational log message.e- Exception
-
finest
public void finest(java.lang.CharSequence message)
Log a message at the 'finest' debugging level. You should check isDebugging() before building the message.- Parameters:
message- Informational log message.
-
exception
public void exception(java.lang.CharSequence message, java.lang.Throwable e)Log a message with exception at the 'severe' level.- Parameters:
message- Error log message.e- Exception
-
exception
public void exception(java.lang.Throwable e)
Log an exception at the 'severe' level.- Parameters:
e- Exception
-
progress
public void progress(Progress pgr)
Log a Progress object.- Parameters:
pgr- Progress to log.
-
newCounter
public Counter newCounter(java.lang.String key)
Generate a new counter.- Parameters:
key- Key to use- Returns:
- Counter.
-
newDuration
public Duration newDuration(java.lang.String key)
Generate a new duration statistic.- Parameters:
key- Key to use- Returns:
- Duration statistic.
-
incrementProcessed
public void incrementProcessed(AbstractProgress prog)
Increment a progress (unlessnull).- Parameters:
prog- Progress to increment, may benull.
-
ensureCompleted
public void ensureCompleted(FiniteProgress prog)
Increment a progress (unlessnull).- Parameters:
prog- Progress to complete, may benull.
-
beginStep
public void beginStep(StepProgress prog, int step, java.lang.String title)
Begin a new algorithm step (unlessnull). 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!- Parameters:
prog- Progress to increment, may benull.step- Step numbertitle- Step title
-
setCompleted
public void setCompleted(StepProgress prog)
Finish a progress (unlessnull).- Parameters:
prog- Progress to complete, may benull.
-
setCompleted
public void setCompleted(IndefiniteProgress prog)
Finish a progress (unlessnull).- Parameters:
prog- Progress to complete, may benull.
-
statistics
public void statistics(Statistic stats)
Log a statistics object.- Parameters:
stats- Statistics object to report.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-