logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <William.Set...@alltel.com>
Subject RE: Jonas 2.4.4 and log4j 1.2beta incompatibility
Date Mon, 01 Apr 2002 22:40:35 GMT

We posted the symptom last Friday on the Jonas forum but no one seems to
have run into the problem at this point.  I will post the "changes
between log4j..." you included to the Jonas group and see what kind of
response I get and let you know.

Thanks for the reply,

-----Original Message-----
From: Ceki Gülcü [mailto:ceki@qos.ch]
Sent: Monday, April 01, 2002 3:55 PM
To: Log4J Users List; log4j-user@jakarta.apache.org
Subject: Re: Jonas 2.4.4 and log4j 1.2beta incompatibility

Hello William,

Changes between log4j version 1.1.x and 1.2

Log4j version 1.2 introduced many changes. In most cases, it can be
considered as a drop in replacement for log4j version 1.1.x. This
section discusses the changes and backward compatibility issues.

Logger replaces Category

The most important change in 1.2 is the replacement of the Category
class with the Logger class. To preserve backward compatibility, the
Logger class extends the Category class such that it is always
possible to use a logger object where a category object is
expected. In addition, whenever log4j is asked to produce a Category
object, it will instead produce a Logger object. Methods that
previously accepted category objects will continue to accept them.

For example, the following are all legal and will work as expected.
       // Deprecated forms:
       Category cat = Category.getInstance("foo.bar")
       Logger logger = Logger.getInstance("foo.bar")
       Category cat = Logger.getLogger("foo.bar")

       // Preferred form for retrieving loggers:
       Logger logger = Logger.getLogger("foo.bar")

There is absolutely no need for new client code to use or refer to the
Category class in newly written code. Please avoid referring to it or
using it. It is important to note that the introduction of the Logger
class is backward compatible. You can still use the older Category
class in your existing code, just avoid writing new code using it.

You may contend that having Logger extend Category is unintuitive --
in particular because the Logger class is almost empty and relies
entirely on the Category class for its implementation. Don't be fooled
by the appearances. The Category class will eventually be removed and
most of its contents transferred to Logger.

Compatibility issues with Category sub-classes

For most users the introduction of the Logger class is fully backward
compatible. However, if you have sub-classed the Category class, then
you need to heed the following points.

         Sub-classes of Category must extend org.apache.log4j.Logger
and not org.apache.log4j.Category.

         The org.apache.log4j.spi.CategoryFactory class has been
removed. It has been replaced with the
org.apache.log4j.spi.LoggerFactory class. Thus, your sub-class'
factory must be of type LoggerFactory.

         The Category.getInstance(String, CategoryFactory) method has
been removed. You need to invoke the LogManager.getLogger(String,
LoggerFactory) method to create loggers of your subclass type.

         In configuration scripts parsed by PropertyConfigurator the
log4j.categoryFactory keyword has been replaced with

We also strongly recommend against sub-classing Logger (or Category)
to introduce new printing methods, you can use the general purpose
log(Level level, Object message) method instead.

The problem you mention with Jonas is clearly related to the
problem mentioned above. Can you please report this to the Jonas people
and let us know how the developers there react? Thank you in advance.

At 15:15 01.04.2002 -0600, William.Settle@alltel.com wrote:
>We downloaded the latest version of Jonas 2.4.4 that uses log4j v1.0.4
>set of API's.
>We are using the log4j 1.2 beta exclusively and when I put the log4j
>beta jar file in front of the class path, Jonas throws a
>java.lang.NoSuchMethodError at
>Turns out that the method
>   Category getInstance(String name, CategoryFactory factory)
>that the Jonas log4j wrapper uses has been deprecated in the beta
>version of log4j.
>I guess I can decompile all of the Jonas's log4j wrapper classes and
>rewrite but that sounds a bit extreme for such a global problem.
>I thought that log4j beta was supposed to be backwards compatible.
>Has anyone else experienced this or have a solution to the problem?

My link of the month: 

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

View raw message