You are on page 1of 1

1.

Logging 

Logging is used to store exceptions, information, and warnings as messages that occur
during the execution of a program. Logging helps a programmer in the debugging
process of a program

1. Logger and Level

• SEVERE (highest level)


• WARNING
• INFO
• CONFIG
• FINE
• FINER
• FINEST (lowest level)

2. Handler

It is responsible for printing the log message at a target destination. The destination can
be a console or a file.

3. Formatter

A Formatter is used to format a LogRecord. Each handler is associated with a formatter. Java provides the Formatter as a
parent class of two in-built formatter’s i.e. SimpleFormatter and XMLFormatter

4. Filter
A  Filter  is an interface in  java.util.logging  package. It is used to control the messages to be logged
by the handler. Every  Logger  and  Handler  optionally can have a  Filter . The  Filter  has
a  isLoggable  method which returns a  boolean . Before publishing the message the  Logger  or
the  Handler  calls this method, if the method returns true the  LogRecord  gets publish else it gets ignored.

5. Configuration
You can provide configuration properties to a  Logger  using a configuration file. This helps you to
remove the configuration from the code and provides an easy way to re-configure whenever it is
required without changing the code again and again. This flexibility is provided by
the  LogManager  class.

You might also like