Log4j2

Log4j2 was obviously inspired by Log4j1 but was completely rewritten. It still has some differences and it is completely different in terms of behavior and performance. Here is the concept mapping for log4j2:

Concept Name
Logger Logger
Logger Factory LoggerManager
Handler Appender
Filter Filter
Formatter Layout
Level Level

The configuration has some fallbacks, but the default file is looked up in the classpath and is called log4j2.xml. It uses a different syntax than the XML version of Log4j1, based on the new plugin system of Log4j2, to have a nicer syntax (less technical):

<?xml version="1.0" encoding="UTF-8"?><Configuration status="WARN">  <Appenders>    <Console name="stdout" target="SYSTEM_OUT"> <PatternLayout ...

Get Java EE 8 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.