Package java.util.logging


Package java.util.logging

Java 1.4

The java.util.logging package defines a sophisticated and highly-configurable logging facility that Java applications can use to emit, filter, format, and output warning, diagnostic, tracing and debugging messages. An application generates log messages by calling various methods of a Logger object. The content of a log message (with other pertinant details such as the time and sequence number) is encapsulated in a LogRecord object generated by the Logger . A Handler object represents a destination for LogRecord objects. Concrete subclasses of Handler support destinations such as files and sockets. Most Handler objects have an associated Formatter that converts a LogRecord object into the actual text that is logged. The subclasses SimpleFormatter and XMLFormatter produce simple plain-text log messages and detailed XML logs respectively.

Each log message has an associated severity level. The Level class defines a type-safe enumeration of defined levels. Logger and Handler objects both have an associated Level , and discard any log messages whose severity is less than that specified level. In addition to this level-based filtering, Logger and Handler objects may also have an associated Filter object which may be implemented to filter log messages based on any desired criteria.

Applications that desire complete control over the logs they generate can create a Logger object, along with Handler , Formatter and Filter objects that control the destination, content, and appearance of the log. Simpler applications need only to create a Logger for themselves , and can leave the rest to the LogManager class. LogManager reads a system-wide configuration file (or a configuration class) and automatically directs log messages to a standard destination (or destinations) for the system. In Java 5.0, LoggingMXBean defines an interface for monitoring and management of the logging facility through the javax.management packages (which are beyond the scope of this book).

Interfaces

 public interface  Filter  ; public interface  LoggingMXBean  ; 

Classes

 public class  ErrorManager  ; public abstract class  Formatter  ;    public class  SimpleFormatter  extends Formatter;    public class  XMLFormatter  extends Formatter; public abstract class  Handler  ;    public class  MemoryHandler  extends Handler;    public class  StreamHandler  extends Handler;       public class  ConsoleHandler  extends StreamHandler;       public class  FileHandler  extends StreamHandler;       public class  SocketHandler  extends StreamHandler; public class  Level  implements Serializable; public class  Logger  ; public final class  LoggingPermission  extends java.security.BasicPermission; public class  LogManager  ; public class  LogRecord  implements Serializable; 



Java In A Nutshell
Java In A Nutshell, 5th Edition
ISBN: 0596007736
EAN: 2147483647
Year: 2004
Pages: 1220

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net