What is log4j
log4j is a reliable, fast and flexible logging framework (APIs)
written in Java, which is
distributed under the Apache Software License.
log4j has been ported to the C, C++, C#, Perl, Python, Ruby, and
Eiffel languages.
log4j is highly configurable through external configuration
files at runtime. It views the
logging process in terms of levels of priorities and offers
mechanisms to direct logging
information
to a great variety of destinations.
Major Features Of Log4j
Log4j is a widely used framework and here are features of log4j :
รผ It is a thread-safe. It is optimized for speed
รผ It is based on a named logger hierarchy.
รผ It supports multiple outputs of appenders per logger.
รผ It supports internationalization.
รผ It is not restricted to a predefined set of facilities.
รผ Logging behavior can be set at runtime using a
configuration file.
รผ It is designed to handle Java Exceptions from the start.
รผ It uses multiple levels, namely ALL, TRACE, DEBUG, INFO,
WARN, ERROR and
FATAL.
รผ The format of the log output can be easily changed by
extending the Layout class.
รผ The target of the log output as well as the writing
strategy can be altered by implementations of the Appender interface.
รผ It is fail-stop. However, although it certainly strives
to ensure delivery, log4j does not
guarantee that each log statement will
be delivered to its destination.
Components of log4j
log4j has three main components:
loggers: Responsible for capturing logging information.
appenders: Responsible for publishing logging information to various
preferred
destinations.
layouts: Responsible for formatting logging information in different
styles.
Pros and Cons of Logging
Following are the Pros and Cons of Logging
Logging is an important component of software development. A
well-written logging code offers quick debugging, easy maintenance, and
structured storage of an application's runtime information. Logging does have
its drawbacks also. It can slow down an application. If too verbose, it can
cause scrolling blindness.
To alleviate these concerns, log4j is designed to be reliable,
fast and extensible. Since logging is rarely the main focus of an application,
the log4j API strives to be simple to understand and to use.
Purpose Of Logger Object
Logger Object − The top-level layer of log4j architecture is the
Logger which provides the
Logger object.
The Logger object is responsible for capturing logging
information and they are stored in a
namespace hierarchy.
Purpose of the Layout object
The layout layer of log4j architecture provides objects which
are used to format logging
information in different styles. It provides support to appender
objects before publishing
logging information.
Layout objects play an important role in publishing logging
information in a way that is
human-readable and reusable.
Purpose of Appender object
The Appender object is responsible for publishing logging
information to various preferred
destinations such as a database, file, console, UNIX Syslog,
etc.
Purpose Of ObjectRenderer Object
The ObjectRenderer object is specialized in providing a String
representation of different
objects passed to the logging framework.
This object is used by Layout objects to prepare the final
logging information.
LogManager object
The LogManager object manages the logging framework. It is
responsible for reading the
initial configuration parameters from a system-wide
configuration file or a configuration
class.
The JavaScript for Beginners course aims to build an in-depth understanding of the various aspects of JS that are mandatory for understanding how JavaScript applications work. Topics covered : JavaScript arrays, functions, and objects, Conditionals, loops, and switch, Building applications with JavaScript. free javascript courses
ReplyYour blog is certainly wonderful, don’t stop the nice work! programar en java
Reply