|
||||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||||
See:
Description
| Class Summary | |
|---|---|
| ConsoleHandlerN | A Console handler that detects duplicate logs. |
| IsLoggableDelegate | A utility to plug into Handlers that want to detect duplicate logs. |
| JULAppender | simple bridge from Log4J to JUL. |
| Logger | Just a wrapper class around java.util.Logger to add specific logging methods. |
| LogManagement | Ths static initialization of this class should be fired early in an application by doing |
| SocketHandlerN | A SocketHandler that detects duplicate publications.Y |
| StreamHandlerN | : A StreamHandler that detects duplicate publications. |
This package provides proxies to the standard java.util.logging package.
Its Logger class is only for codes that log messages or data (not for codes that deal with Level,
Formatters or Handlers). It provides methods that can simply replace logging invocations
meant to be handled by Log4J or simple standard java logging invocations: you can then in your codes
just change the import directives and keep you code "as is".
Logger logger = Logger.getLogger("org.lsst.ccs.mypackage") ;
//....
logger.info("doing the right thing!") ;
//...
if( logger.isInfoEnabled() ) {
logger.log(Level.INFO, "still better", methodCall()) ;
}
//...
try {
//...
} catch(Exception exc) {
logger.error("Oops!", exc) ;
}
But the Logger class is not only to get syntactic sugar: it provides access to "multi-dimensional logging".
What's that?
The idea is that can log the same call to different loggers in a single invocation.
So, for instance, you have the usual logger linked to a package but you want also to address different "concerns" that
are common to different classes or package. Then you can write:
logger.log(Level.INFO, "Object being initialized", theObject, "INIT");
this means that the created LogRecord will be submitted to the current Logger
and also to another one named "INIT".
logger.log(Level.INFO, "Object being moved at initialisation", theObject, "INIT", "MOVE");
Then you can set the level for the corresponding package to SEVERE and set the level
of the "INIT" concern to INFO .
# ------------------------------------------ # The set of handlers to be loaded upon startup. # Comma-separated list of class names. # (? LogManager docs say no comma here, but JDK example has comma.) # handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler handlers=org.lsst.ccs.utilities.logging.ConsoleHandlerN # Default global logging level. # Loggers and Handlers may override this level .level=INFO # Loggers # ------------------------------------------ # Loggers are usually attached to packages. # Here, the level for each package is specified. # The global level is used by default, so levels # specified here simply act as an override. #myapp.ui.level=ALL #myapp.business.level=CONFIG #myapp.data.level=SEVERE org.lsst=CONFIG MOVE=FINEST # Handlers # ----------------------------------------- # --- ConsoleHandler --- # Override of global logging level #java.util.logging.ConsoleHandler.level=SEVERE org.lsst.ccs.utilities.logging.ConsoleHandlerN.level=FINEST
|
||||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||||