Package elki.logging
Class LoggingConfiguration
- java.lang.Object
-
- elki.logging.LoggingConfiguration
-
public final class LoggingConfiguration extends java.lang.Object
Facility for configuration of logging.- Since:
- 0.1
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
confbase
Configuration baseprotected static LoggingConfiguration
config
Static instance of the configurationstatic boolean
DEBUG
General debug flag.private static java.util.logging.Logger
LOGGER_ELKI_TOP
Logger for ELKI top level package.private static java.util.logging.Logger
LOGGER_GLOBAL_TOP
Top level logger.private static java.util.logging.Logger
LOGGER_TIME_TOP
Logger for ELKI timing.private static java.lang.String
LOGGING_PROPERTIES_FILE
Configuration file namestatic java.lang.String
TOPLEVEL_PACKAGE
Top level ELKI package (for setting 'verbose')
-
Constructor Summary
Constructors Modifier Constructor Description private
LoggingConfiguration(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 void
addHandler(java.util.logging.Handler handler)
Add a handler to the root logger.static void
assertConfigured()
Assert that logging was configured.private static java.io.InputStream
openSystemFile(java.lang.String filename)
Private copy from FileUtil, to avoid cross-dependencies.private void
privateReconfigureLogging(java.lang.String pkg, java.lang.String name)
Reconfigure logging.static void
reconfigureLogging(java.lang.String pkg, java.lang.String name)
Reconfigure logging.static void
replaceDefaultHandler(java.util.logging.Handler handler)
Replace the default log handler with the given log handler.static void
setDefaultLevel(java.util.logging.Level level)
Set the default level.static void
setLevelFor(java.lang.String pkg, java.lang.String level)
Set the logging level for a particular package/class.static void
setStatistics()
Enable runtime performance logging.static void
setVerbose(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.IOException
Private 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 allCLISmartHandler
found 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.IllegalArgumentException
Set 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
-
-