ZNHOO Whatever you are, be a good one!

Log4j

  1. ABCs

ABCs

There are three core components of Log4j:

  1. Logger: log level priority.

    From highest to lowest:

    OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL
    
    1. The lower a level is, the more detailed is the log.
    2. When a particular log level is set, logs of higher levels are also printed while logs of lower levels are not. Specailly, 'OFF' turns off log completely while 'ALL' prints everything.
    3. Use 'ERROR' or 'WARN' to avoid demanding log storage in practice.
  2. Appender: determine destinations of log output, console, files, remote socket servers, Apache Flume, JMS, remote UNIX Syslog daemons, and various database APIs etc.

    Often, log to either console or file.

  3. Layout: log format.