Log4j
11 Apr 2019 • Leave CommentsABCs
There are three core components of Log4j:
-
Logger: log level priority.
From highest to lowest:
OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL
- The lower a level is, the more detailed is the log.
- 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.
- Use 'ERROR' or 'WARN' to avoid demanding log storage in practice.
-
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.
-
Layout: log format.