|
87 | 87 | So, what makes upgrading to Log4j 2 a wise decision? Here are a few compelling reasons.
|
88 | 88 | </p>
|
89 | 89 | <ol>
|
90 |
| - <li>Log4j 2 is designed to be usable as an audit logging framework. Both Log4j |
| 90 | + <li><b>Audit Logging:</b> Log4j 2 is designed to be usable as an audit logging framework. Both Log4j |
91 | 91 | 1.x and Logback will lose events while reconfiguring. Log4j 2 will not. In
|
92 | 92 | Logback, exceptions in Appenders are never visible to the application. In
|
93 | 93 | Log4j 2 Appenders can be configured to allow the exception to percolate
|
94 | 94 | to the application.</li>
|
95 |
| - <li>Log4j 2 contains next-generation <a href="async.html">Asynchronous Loggers</a> based |
| 95 | + <li><b>Asynchronous Loggers:</b> Log4j 2 contains next-generation <a href="async.html">Asynchronous Loggers</a> based |
96 | 96 | on the <a href="https://lmax-exchange.github.io/disruptor/">LMAX Disruptor library</a>.
|
97 | 97 | In multithreaded scenarios Asynchronous Loggers have 10 times higher throughput and
|
98 | 98 | orders of magnitude lower latency than Log4j 1.x and Logback.</li>
|
99 |
| - <li>Log4j 2 is <a href="garbagefree.html">garbage free</a> for |
| 99 | + <li><b>Garbage Free:</b> Log4j 2 is <a href="garbagefree.html">garbage free</a> for |
100 | 100 | stand-alone applications, and low garbage for web applications during steady state logging.
|
101 | 101 | This reduces pressure on the garbage collector and can give better response time performance.</li>
|
102 |
| - <li>Log4j 2 uses a <a href="plugins.html">Plugin system</a> that makes it extremely easy to |
| 102 | + <li><b>Plugins:</b> Log4j 2 uses a <a href="plugins.html">Plugin system</a> that makes it extremely easy to |
103 | 103 | <a href="extending.html">extend the framework</a> by adding new <a href="appenders.html">Appenders</a>,
|
104 | 104 | <a href="filters.html">Filters</a>, <a href="layouts.html">Layouts</a>, <a href="lookups.html">Lookups</a>,
|
105 | 105 | and Pattern Converters without requiring any changes to Log4j.</li>
|
106 |
| - <li>Due to the Plugin system configuration is simpler. Entries in the configuration |
| 106 | + <li><b>Simple Configuration:</b> Due to the Plugin system configuration is simpler. Entries in the configuration |
107 | 107 | do not require a class name to be specified.</li>
|
108 |
| - <li>Support for <a href="customloglevels.html">custom log levels</a>. |
| 108 | + <li><b>Custom Log Levels:</b> Support for <a href="customloglevels.html">custom log levels</a>. |
109 | 109 | Custom log levels can be defined in code or in configuration.</li>
|
110 |
| - <li>Support for <a href="api.html#LambdaSupport">lambda expressions</a>. |
| 110 | + <li><b>Lambdas:</b> Support for <a href="api.html#LambdaSupport">lambda expressions</a>. |
111 | 111 | Client code running on Java 8 can use lambda expressions to lazily construct a log message only if
|
112 | 112 | the requested log level is enabled. Explicit level checks are not needed, resulting in cleaner code.</li>
|
113 |
| - <li>Support for <a href="messages.html">Message objects</a>. Messages allow support for interesting and |
| 113 | + <li><b>Messages:</b> Support for <a href="messages.html">Message objects</a>. Messages allow support for interesting and |
114 | 114 | complex constructs to be passed through the logging system and be efficiently
|
115 | 115 | manipulated. Users are free to create their own
|
116 | 116 | <code><a href="../log4j-api/apidocs/org/apache/logging/log4j/message/Message.html">Message</a></code>
|
117 | 117 | types and write custom <a href="layouts.html">Layouts</a>, <a href="filters.html">Filters</a> and
|
118 | 118 | <a href="lookups.html">Lookups</a> to manipulate them.</li>
|
119 |
| - <li>Log4j 1.x supports Filters on Appenders. Logback added TurboFilters to allow |
| 119 | + <li><b>Filters:</b> Log4j 1.x supports Filters on Appenders. Logback added TurboFilters to allow |
120 | 120 | filtering of events before they are processed by a Logger. Log4j 2 supports
|
121 | 121 | Filters that can be configured to process events before they are handled by
|
122 | 122 | a Logger, as they are processed by a Logger or on an Appender.</li>
|
123 |
| - <li>Many Logback Appenders do not accept a Layout and will only send data in a |
| 123 | + <li><b>Appender Layout:</b> Many Logback Appenders do not accept a Layout and will only send data in a |
124 | 124 | fixed format. Most Log4j 2 Appenders accept a Layout, allowing the data to
|
125 | 125 | be transported in any format desired.</li>
|
126 |
| - <li>Layouts in Log4j 1.x and Logback return a String. This resulted in the problems |
| 126 | + <li><b>Advanced Layouts:</b> Layouts in Log4j 1.x and Logback return a String. This resulted in the problems |
127 | 127 | discussed at <a href="https://logback.qos.ch/manual/encoders.html">Logback Encoders</a>.
|
128 | 128 | Log4j 2 takes the simpler approach that <a href="layouts.html">Layouts</a> always return a byte array. This has
|
129 | 129 | the advantage that it means they can be used in virtually any Appender, not just
|
130 | 130 | the ones that write to an OutputStream.</li>
|
131 | 131 | <!-- and coming up: ByteBuffers, too! -->
|
132 |
| - <li>The <a href="appenders.html#SyslogAppender">Syslog Appender</a> supports both TCP and UDP as well as |
| 132 | + <li><b>Syslog Support:</b> The <a href="appenders.html#SyslogAppender">Syslog Appender</a> supports both TCP and UDP as well as |
133 | 133 | support for the BSD syslog
|
134 | 134 | and the <a href="https://tools.ietf.org/html/rfc5424">RFC 5424</a> formats.</li>
|
135 |
| - <li>Log4j 2 takes advantage of Java 5 concurrency support and performs locking |
| 135 | + <li><b>Java Concurrency:</b> Log4j 2 takes advantage of Java 5 concurrency support and performs locking |
136 | 136 | at the lowest level possible. Log4j 1.x has known deadlock issues. Many of these
|
137 | 137 | are fixed in Logback but many Logback classes still require synchronization at
|
138 | 138 | a fairly high level.</li>
|
139 |
| - <li>It is an Apache Software Foundation project following the community and support |
| 139 | + <li><b>Community:</b> It is an Apache Software Foundation project following the community and support |
140 | 140 | model used by all ASF projects. If you want to contribute or gain the right to
|
141 | 141 | commit changes just follow the path outlined at
|
142 | 142 | <a href="https://jakarta.apache.org/site/contributing.html">Contributing</a>.</li>
|
|
0 commit comments