Differences between revisions 52 and 53
Revision 52 as of 2013-04-29 04:53:48
Size: 10513
Revision 53 as of 2013-04-29 06:09:20
Size: 10729
Editor: tonyguards
Deletions are marked like this. Additions are marked like this.
Line 86: Line 86:
[[http://www.remotestaff.com.au/rs/candidates/software_development/|Hire Software Developers]] [[http://www.doxapest.co.id/index.php/pest-control-dan-anti-rayap|Anti Rayap]] [[http://www.goldenfibreglass.com/product-atap-fiberglass.php|Atap Fiberglass]] [[http://littletods.com/en/content/4-perlengkapan-bayi|Perlengkapan Bayi]] [[http://saranasukses.com/outsourcing-indonesia.html|Outsourcing Indonesia]]

Log4j v1.3 Changes and New Features

NB: Log4j 1.3 development has been abandoned and no future releases or development are anticipated. See http://logging.apache.org/log4j/1.3/index.html

This page will be updated by developers to describe important changes and features in the upcoming version 1.3 of log4j. If you have any questions or comments, please post them to the log4j-user mailing list.

JDK 1.2 or later required

The decision was made that starting with v1.3, the log4j framework will require JDK 1.2 or later. Users required to use JDK 1.1 can still use the current v1.2.X. This decision was not made lightly, but most of the current Jakarta projects require JDK 1.2 or later. And there are many "modern" classes/convienences that log4j can use and take advantage of.

Joran configurator

JoranConfigurator handles (parses) config files in XML format. The intention is to have Joran to replace DOMConfigurator.

Joran does not do much for the time being. However, Ceki claims to have all the parts working in his head, he just needs to transcribe it in Java.

Joran parses files based on rules: patterns and actions. It has one advantage compared DOMConfigurator. JoranConfigurator can learn new rules at runtime without need for recompilation.

Joran is very similar to commons-digester. Joran is largely modeled after it. However, commons-digester uses commons-logging which is a no-no for a core log4j component. Other than that Joran differs from Digester in the following minor ways:

  • It uses a DOM tree instead of SAX events
  • Joran supports implicit actions.

Implicit action are applied when no explicit rule applies. The action is asked to check whether it is applicable in the current context. If it says yes, then it is applied.

Plugins, Receivers, and Watchdogs...oh my!

Plugins will be added to version 1.3 and will provide a powerful mechanism for log4j users to add/extend log4j. Plugins can be configured to operate on a  LoggerRepository , and will be configurable via configuration files (at least XML). They can also be started, stopped, restarted programatically. What the plugin actually does is entirely up to the developer. A  PluginRegistry  service is provided to manage the lifetime of a plugin, starting and stopping the plugin at the appropriate points in the Plugin/ LoggerRepository  lifetime. Two uses of plugins planned for version 1.3 are Receivers and Watchdogs.

  • Receivers can be thought of as the opposite of Appenders. Appenders send log4j  LoggingEvents  "outside" of the log4j environment (file, socket, jms, etc). Receivers bring "outside" or remote events into the log4j environment. They receive the events and then "post" them to the log4j environment (the  LoggerRepository  to which they are "attached") where they will be handled by the configured appenders. Immediate implementations of the Receiver interface shipping with v1.3 will be  SocketReceiver  (receives events from  SocketAppender ),  SocketHubReceiver  (receives events from  SocketHubAppender ), and  JMSReceiver  (receives events from  JMSAppender ). Users will be able to configure these receivers via a configuration file (at least XML).

A single configuration could receive events from multiple  SocketAppender ,  SocketHubAppender , and/or  JMSAppender  sources. This will simplify the task of creating a remote logging server, and renders obsolete the  SocketServer  and  JMSSink  classes. And this is probably just the beginning. One could, for example, write a receiver to append logging events appended to the JDK 1.4 Logging API. Why would you want to? Don't know, but now you'll be able to, should the need arise. We are sure other sources will appear. Receivers will also make it much easier for the gui clients like Chainsaw and LF5 to receive logging events from multiple destinations and from appender types not yet developed. All they need is to be configured with the appropriate set of receivers in the configuration on

  • file.
  • Watchdogs have been discussed quite a bit over the past year. They will provide the functionality of  configureAndWatch() , that is, they will watch a "source" for changed/updated configuration data. When the source changes, the Watchdog will reconfigure the  LoggerRepository  to which it is attached with the updated configuration data. The current  configureAndWatch()  mechanism is very popular, but has some fundamental issues. First, once a  configureAndWatch()  thread has been created, there is no mechanism to stop it. Second,  configureAndWatch()  can only be accessed programmatically, not through configuration files. Third,  configureAndWatch()  can only watch files. Maybe not that big of a deal, but problematic if you are trying to control the configuration on multiple machines. The new Watchdogs will fix all of this. Because Watchdogs implement the Plugin interface, they can be started/stopped programatically or configured via configuration files. That solves the first and second problems. There will also be a host of Watchdog implementations, each one dealing with a different format/source of updated configuration data:  FileWatchdog  (watches a file),  HttpWatchdog  (watches the modified date on a url), and  SocketWatchdog  (receives updated configuration data over a socket). This solves the third problem. Plus, developers will be able to develop their own Watchdog implementations by extending the base classes in log4j or implementing their own Watchdog interfaces. The Watchdog design is configurator independent, which means they will work with  PropertyConfigurator ,  DOMConfigurator , or some configurator not yet written.


The new package, org.apache.log4j.filters, will either ship as part of the core v1.3 release or as part of a "sandbox" or auxiliary package. Either way, it will contain a set of useful appender filters.

  •  MatchFilterBase  - An abstract class that is the parent class for the match filters implemented in this package. It provides setters to configure the filter as a single stand alone filter or as part of a "filter chain". One can put together very complex chains of filters, each "link" accepting, denying, or passing the logging event. This capability is already present in v1.2.X, but this class exposes this capability in a very useful manner. Developers are free to use this class as a base class for filters they develop, thus making them "chain" compatible with configurable in the same way.

  •  LevelMatchFilter  - Filters logging events based on the level set for the logger logging the event.

  •  LevelRangeMatchFilter  - Filters logging events based on a range of possible levels.

  •  ["MDCMatchFilter"]  - Filters logging events based on key/value pair values in the MDC at the time the event was logged.

  •  ["NDCMatchFilter"]  - Filters logging events based on the contents of the NDC at the time the event was logged.

  •  MessageMatchFilter.java  - Filters logging events based on the contents of the log message being logged

  •  SetLocationInfoFilter  - Sets the location info for the logging event. Used in conjunction with the above filters, it makes it possible to set the location info for some logging events and not others. This helps overall performance as setting location information for all logging events would be too costly. But the info is very useful is some situations.

All of the above classes are currently checked into the log4j cvs repository, so if you want to use/review them now, feel free.


The new package, org.apache.log4j.servlet, will either ship as part of the core v1.3 release or as part of a "sandbox" or auxilary package. Either way, it will contain a set of useful classes that can be used in the servlet/web application environment. Currently planned/implemented are:

  •  InitServlet  - A Servlet compatible with Servlet 2.2 or 2.3 compliant web containers that initializes log4j in the web application environment.

  •  InitContextListener  - A  ServletContextListener  compatible with 2.3 compliant web containers that initializes and shuts down log4j when the web application starts and shuts down.

  •  ConfigurationServlet  - A Servlet which can be used to view/modify the current log4j logger settings for a web application.

  •  ["CookieMDCFilter"]  - A  ServletFilter  that copies a set of cookie values into the log4j MDC before the  ServletRequest  is processed.



The new package, org.apache.log4j.selectors, is an experimental package that will be provided as part of a "sandbox" or auxiliary package. The various classes will implement the  org.apache.log4j.spi.RepositorySelector  interface in various ways. These will serve as both examples to those that need to implement their own version while also providing implementations useful in web application and other development.

  •  ContextClassLoaderSelector  - Implements the  RepositorySelector  interface, choosing the repository based on the current Java class loader.

  •  ["ContextJNDISelector"]  - Implements the  RepositorySelector  interface, choosing the repository based on the JNDI name-space provided in J2EE environments.

Packaging changes

In the v1.3 release, the Chainsaw and LF5 tools will be packaged in separate, executable jars. This will reduce the size of the core log4j jar, and separate the "required" classes from the tool/client classes.

There will also be a set of "sandbox" or auxiliary jars that will contain useful, possibly experimental, classes that log4j users can use, but the classes don't yet belong in the core log4j jar.

Chainsaw v2

Here is a screenshot of the latest build of Chainsaw v2:

Anti Rayap Atap Fiberglass Perlengkapan Bayi Outsourcing Indonesia

Log4jv13Features (last edited 2013-04-29 06:09:20 by tonyguards)