January 2018
Intermediate to advanced
350 pages
9h 7m
English
Logj4 (1.x) uses the org.apache.log4j base package. Here are the logging concepts we talked about adapted to log4j1 semantic:
| Concept | Name |
| Logger | Logger |
| Logger Factory | Logger |
| Handler | Appender |
| Filter | Filter |
| Formatter | Layout |
| Level | Level |
Most of the concepts are the same as in JUL, but with a few different names.
In terms of usage, it is the same as in JUL, except it uses another package:
final Logger logger = Logger.getLogger("name.of.the.logger");logger.info("message");
What is a bit different is the configuration. It uses a log4j.properties or log4j.xml in the classpath (by default) which looks like this:
log4j.rootLogger=DEBUG, stdoutlog4j.appender.stdout=org.apache.log4j.ConsoleAppenderlog4j.appender.stdout.layout=org.apache.log4j.PatternLayout ...
Read now
Unlock full access