logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: Bridge to other logging APIs
Date Sun, 21 Jul 2013 07:16:15 GMT
First, I have to state that java.util.logging absolutely sucks.  Ceki once mentioned that
the guys who did the JCR asked him for advice.  From what I can tell they took his advice
and did exactly the opposite.  While the API isn't horrible, the implementation is very primitive.
But the worst part is that to hook in your own implementation you have to set a system property
- and even that doesn't really work.  Unfortunately, JUL was created before ServiceLoader
existed and it has never been improved to allow for it.  But the worst part is that the Sun
LogManager class does a new on LogManager.RootLogger to create the root Logger and doesn't
even delegate its creation to the delegated LogManager, which makes it impossible to use Log4j
for the root logger.  So the only other option is to hook into JUL as a Handler, which is
what SLF4J does.

After all of that I looked at jul-to-slf4j and even though I hate the way it works I came
to the conclusion we weren't going to do much better. I couldn't bring myself to just reimplement
that on top of the Log4j API and since the performance pretty much sucks anyway that user's
should just use it and route SLF4J to Log4j 2.

FWIW, Gary asked about this last November and I gave him a similar answer, although at the
time I had not looked into actually creating an implementation so I didn't know about the
challenges of creating your own LogManager..


On Jul 20, 2013, at 8:45 PM, Remko Popma wrote:

> I had not considered that "bridge" might suggest that the log4j-1.2 jar would be needed.
That's a good reason not to use "bridge" actually.
> My reason for disliking "api" was that in the past when people asked which jars to use
I'd say "the api and the core jars", and that's why I didn't like having two api jars. But
I see now that there are many ways to look at this, and there is never going to be a perfect
name that every user will interpret the way we intended it. 
> Thanks for listing up the naming history. Looks like we've done our best on this already
and I'm fine with leaving well enough alone.
> I have started on the diagram. Question: how can apps that are coded to the Java Util
Logging API have their logging calls be routed to the Log4j2 impl?
> Question2: where in the site should the diagram go? Inside the manual (and the manual
PDF)? Or perhaps a new "Install" page in the "APACHE LOG4J2" section?
> (BTW we should clarify on the "Build" page that building log4j is only for people who
want to contribute to Log4j, and is not required for normal usage.
> Apparently some people get confused about this... http://stackoverflow.com/questions/17762723/building-log4j-2-0-in-my-web-project
> From: Ralph Goers <ralph.goers@dslextreme.com>
> To: Log4J Developers List <log4j-dev@logging.apache.org> 
> Sent: Sunday, July 21, 2013 8:09 AM
> Subject: Re: Bridge to other logging APIs
> Why do you dislike including "api" in the name.  I have a problem with "bridge" because
to me it implies that I also need the Log4j 1.2 jar.  I prefer the current name because it
provides the Log4j 1.2 API (not the Log4j 1.2 implementation).  The fact that it is part of
Log4j 2.0 should make it obvious that it binds that API to Log4j 2.0.
> Please note that I am at the point where I don't believe anyone will be happy with whatever
name is chosen and so I would prefer to leave them alone.  In [1] below you will see the request
to group them all under the "adapters" groupId and then under [2] the request to bring them
back to core and then in [3] to leave them in core but rename them to "bridge".
> [1] http://marc.info/?t=134747176600003&r=1&w=2
> [2] http://marc.info/?t=136560014200006&r=1&w=2
> [3] http://marc.info/?t=137411336500001&r=1&w=2
> Ralph
> On Jul 20, 2013, at 7:04 AM, Remko Popma wrote:
>> I realize I made a mistake: I would like to rename the log4j-1.2-api jar to log4j-1.2-bridge-2.0.jar
(without api in the name).
>> From: Gary Gregory <garydgregory@gmail.com>; 
>> To: Log4J Developers List <log4j-dev@logging.apache.org>; 
>> Subject: Re: Bridge to other logging APIs 
>> Sent: Thu, Jul 18, 2013 2:24:07 AM 
>> I also find the inconsistency  in naming confusing. I always have to read the description
to remind myself what direction a module follows.
>> Gary
>> On Wed, Jul 17, 2013 at 10:11 PM, Nick Williams <nicholas@nicholaswilliams.net>
>> Agreed, on all counts.
>> Nick
>> On Jul 17, 2013, at 9:07 PM, Remko Popma wrote:
>>> Currently we have three different names for things that provide a bridge/adapter
from other logging APIs to the Log4j2 implementation:
>>> (Commons Logging) Bridge, (Log4j 1.2) API, and (SLF4J) Binding.
>>> Would it be a good idea to call them all "Bridge"?
>>> On the web site, components would then become:
>>> Commons Logging Bridge, Log4j 1.2 Bridge, and SLF4J Bridge.
>>> The jar files would become:
>>> log4j-jcl-bridge-2.0.jar
>>> log4j-1.2-api-bridge-2.0.jar
>>> log4j-slf4j-bridge-2.0.jar
>>> I would especially like to rename log4j-1.2-api-2.0.jar so we only have one jar
with "api" in the name.
>>> Thoughts?
>> -- 
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
>> Java Persistence with Hibernate, Second Edition
>> JUnit in Action, Second Edition
>> Spring Batch in Action
>> Blog: http://garygregory.wordpress.com 
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory

View raw message