Package elki.logging
Class LoggingConfiguration
- java.lang.Object
-
- elki.logging.LoggingConfiguration
-
public final class LoggingConfiguration extends java.lang.ObjectFacility for configuration of logging.- Since:
- 0.1
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringconfbaseConfiguration baseprotected static LoggingConfigurationconfigStatic instance of the configurationstatic booleanDEBUGGeneral debug flag.private static java.util.logging.LoggerLOGGER_ELKI_TOPLogger for ELKI top level package.private static java.util.logging.LoggerLOGGER_GLOBAL_TOPTop level logger.private static java.util.logging.LoggerLOGGER_TIME_TOPLogger for ELKI timing.private static java.lang.StringLOGGING_PROPERTIES_FILEConfiguration file namestatic java.lang.StringTOPLEVEL_PACKAGETop level ELKI package (for setting 'verbose')
-
Constructor Summary
Constructors Modifier Constructor Description privateLoggingConfiguration(java.lang.String pkg, java.lang.String name)Configure Java Logging API:LogManager
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddHandler(java.util.logging.Handler handler)Add a handler to the root logger.static voidassertConfigured()Assert that logging was configured.private static java.io.InputStreamopenSystemFile(java.lang.String filename)Private copy from FileUtil, to avoid cross-dependencies.private voidprivateReconfigureLogging(java.lang.String pkg, java.lang.String name)Reconfigure logging.static voidreconfigureLogging(java.lang.String pkg, java.lang.String name)Reconfigure logging.static voidreplaceDefaultHandler(java.util.logging.Handler handler)Replace the default log handler with the given log handler.static voidsetDefaultLevel(java.util.logging.Level level)Set the default level.static voidsetLevelFor(java.lang.String pkg, java.lang.String level)Set the logging level for a particular package/class.static voidsetStatistics()Enable runtime performance logging.static voidsetVerbose(java.util.logging.Level verbose)Reconfigure logging to enable 'verbose' logging at the top level.
-
-
-
Field Detail
-
DEBUG
public static boolean DEBUG
General debug flag.
-
LOGGING_PROPERTIES_FILE
private static final java.lang.String LOGGING_PROPERTIES_FILE
Configuration file name- See Also:
- Constant Field Values
-
TOPLEVEL_PACKAGE
public static final java.lang.String TOPLEVEL_PACKAGE
Top level ELKI package (for setting 'verbose')- See Also:
- Constant Field Values
-
LOGGER_GLOBAL_TOP
private static final java.util.logging.Logger LOGGER_GLOBAL_TOP
Top level logger.
-
LOGGER_ELKI_TOP
private static final java.util.logging.Logger LOGGER_ELKI_TOP
Logger for ELKI top level package.
-
LOGGER_TIME_TOP
private static final java.util.logging.Logger LOGGER_TIME_TOP
Logger for ELKI timing.
-
confbase
private static final java.lang.String confbase
Configuration base
-
config
protected static LoggingConfiguration config
Static instance of the configuration
-
-
Method Detail
-
reconfigureLogging
public static void reconfigureLogging(java.lang.String pkg, java.lang.String name)Reconfigure logging.- Parameters:
pkg- Package name the configuration file comes fromname- File name.
-
privateReconfigureLogging
private void privateReconfigureLogging(java.lang.String pkg, java.lang.String name)Reconfigure logging.- Parameters:
pkg- Package name the configuration file comes fromname- File name.
-
openSystemFile
private static java.io.InputStream openSystemFile(java.lang.String filename) throws java.io.IOExceptionPrivate copy from FileUtil, to avoid cross-dependencies. Try to open a file, first trying the file system, then falling back to the classpath.- Parameters:
filename- File name in system notation- Returns:
- Input stream
- Throws:
java.io.IOException
-
assertConfigured
public static void assertConfigured()
Assert that logging was configured.
-
setVerbose
public static void setVerbose(java.util.logging.Level verbose)
Reconfigure logging to enable 'verbose' logging at the top level.- Parameters:
verbose- verbosity level.
-
setStatistics
public static void setStatistics()
Enable runtime performance logging.
-
addHandler
public static void addHandler(java.util.logging.Handler handler)
Add a handler to the root logger.- Parameters:
handler- Handler
-
replaceDefaultHandler
public static void replaceDefaultHandler(java.util.logging.Handler handler)
Replace the default log handler with the given log handler. This will remove allCLISmartHandlerfound on the root logger. It will leave any other handlers in place.- Parameters:
handler- Logging handler.
-
setLevelFor
public static void setLevelFor(java.lang.String pkg, java.lang.String level) throws java.lang.IllegalArgumentExceptionSet the logging level for a particular package/class.- Parameters:
pkg- Packagelevel- Level name- Throws:
java.lang.IllegalArgumentException- thrown when logger or level was not found
-
setDefaultLevel
public static void setDefaultLevel(java.util.logging.Level level)
Set the default level.- Parameters:
level- level
-
-