src/share/classes/java/util/logging/LogManager.java

Print this page




  39 /**
  40  * There is a single global LogManager object that is used to
  41  * maintain a set of shared state about Loggers and log services.
  42  * <p>
  43  * This LogManager object:
  44  * <ul>
  45  * <li> Manages a hierarchical namespace of Logger objects.  All
  46  *      named Loggers are stored in this namespace.
  47  * <li> Manages a set of logging control properties.  These are
  48  *      simple key-value pairs that can be used by Handlers and
  49  *      other logging objects to configure themselves.
  50  * </ul>
  51  * <p>
  52  * The global LogManager object can be retrieved using LogManager.getLogManager().
  53  * The LogManager object is created during class initialization and
  54  * cannot subsequently be changed.
  55  * <p>
  56  * At startup the LogManager class is located using the
  57  * java.util.logging.manager system property.
  58  * <p>
  59  * By default, the LogManager reads its initial configuration from
  60  * a properties file "lib/logging.properties" in the JRE directory.
  61  * If you edit that property file you can change the default logging
  62  * configuration for all uses of that JRE.
  63  * <p>
  64  * In addition, the LogManager uses two optional system properties that
  65  * allow more control over reading the initial configuration:
  66  * <ul>
  67  * <li>"java.util.logging.config.class"
  68  * <li>"java.util.logging.config.file"
  69  * </ul>
  70  * These two properties may be set via the Preferences API, or as
  71  * command line property definitions to the "java" command, or as
  72  * system property definitions passed to JNI_CreateJavaVM.
  73  * <p>
  74  * If the "java.util.logging.config.class" property is set, then the
  75  * property value is treated as a class name.  The given class will be
  76  * loaded, an object will be instantiated, and that object's constructor
  77  * is responsible for reading in the initial configuration.  (That object
  78  * may use other system properties to control its configuration.)  The
  79  * alternate configuration class can use <tt>readConfiguration(InputStream)</tt>
  80  * to define properties in the LogManager.
  81  * <p>
  82  * If "java.util.logging.config.class" property is <b>not</b> set,
  83  * then the "java.util.logging.config.file" system property can be used
  84  * to specify a properties file (in java.util.Properties format). The
  85  * initial logging configuration will be read from this file.
  86  * <p>
  87  * If neither of these properties is defined then, as described
  88  * above, the LogManager will read its initial configuration from
  89  * a properties file "lib/logging.properties" in the JRE directory.

  90  * <p>
  91  * The properties for loggers and Handlers will have names starting
  92  * with the dot-separated name for the handler or logger.
  93  * <p>
  94  * The global logging properties may include:
  95  * <ul>
  96  * <li>A property "handlers".  This defines a whitespace or comma separated
  97  * list of class names for handler classes to load and register as
  98  * handlers on the root Logger (the Logger named "").  Each class
  99  * name must be for a Handler class which has a default constructor.
 100  * Note that these Handlers may be created lazily, when they are
 101  * first used.
 102  *
 103  * <li>A property "&lt;logger&gt;.handlers". This defines a whitespace or
 104  * comma separated list of class names for handlers classes to
 105  * load and register as handlers to the specified logger. Each class
 106  * name must be for a Handler class which has a default constructor.
 107  * Note that these Handlers may be created lazily, when they are
 108  * first used.
 109  *




  39 /**
  40  * There is a single global LogManager object that is used to
  41  * maintain a set of shared state about Loggers and log services.
  42  * <p>
  43  * This LogManager object:
  44  * <ul>
  45  * <li> Manages a hierarchical namespace of Logger objects.  All
  46  *      named Loggers are stored in this namespace.
  47  * <li> Manages a set of logging control properties.  These are
  48  *      simple key-value pairs that can be used by Handlers and
  49  *      other logging objects to configure themselves.
  50  * </ul>
  51  * <p>
  52  * The global LogManager object can be retrieved using LogManager.getLogManager().
  53  * The LogManager object is created during class initialization and
  54  * cannot subsequently be changed.
  55  * <p>
  56  * At startup the LogManager class is located using the
  57  * java.util.logging.manager system property.
  58  * <p>
  59  * The LogManager defines two optional system properties that allow control over 
  60  * the initial configuration:





  61  * <ul>
  62  * <li>"java.util.logging.config.class"
  63  * <li>"java.util.logging.config.file"
  64  * </ul>
  65  * These two properties may be specified on the command line to the "java" 
  66  * command, or as system property definitions passed to JNI_CreateJavaVM.

  67  * <p>
  68  * If the "java.util.logging.config.class" property is set, then the
  69  * property value is treated as a class name.  The given class will be
  70  * loaded, an object will be instantiated, and that object's constructor
  71  * is responsible for reading in the initial configuration.  (That object
  72  * may use other system properties to control its configuration.)  The
  73  * alternate configuration class can use <tt>readConfiguration(InputStream)</tt>
  74  * to define properties in the LogManager.
  75  * <p>
  76  * If "java.util.logging.config.class" property is <b>not</b> set,
  77  * then the "java.util.logging.config.file" system property can be used
  78  * to specify a properties file (in java.util.Properties format). The
  79  * initial logging configuration will be read from this file.
  80  * <p>
  81  * If neither of these properties is defined then the LogManager uses its
  82  * default configuration. The default configuration is typically loaded from the
  83  * properties file "{@code lib/logging.properties}" in the Java installation 
  84  * directory.
  85  * <p>
  86  * The properties for loggers and Handlers will have names starting
  87  * with the dot-separated name for the handler or logger.
  88  * <p>
  89  * The global logging properties may include:
  90  * <ul>
  91  * <li>A property "handlers".  This defines a whitespace or comma separated
  92  * list of class names for handler classes to load and register as
  93  * handlers on the root Logger (the Logger named "").  Each class
  94  * name must be for a Handler class which has a default constructor.
  95  * Note that these Handlers may be created lazily, when they are
  96  * first used.
  97  *
  98  * <li>A property "&lt;logger&gt;.handlers". This defines a whitespace or
  99  * comma separated list of class names for handlers classes to
 100  * load and register as handlers to the specified logger. Each class
 101  * name must be for a Handler class which has a default constructor.
 102  * Note that these Handlers may be created lazily, when they are
 103  * first used.
 104  *