You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Manoj Prasad <ma...@yahoo.com> on 2005/02/16 04:30:43 UTC

[PATCH] log4j to commons-logging conversion

Hi,

I saw this mentioned in the ToDo.txt file and thought
I would give it a try. I wrote a Perl script that did
it all automatically except for LogPrintWriter.java
which I updated manually. There is no API to "Level"
in commons-logging, so I deleted it - please confirm
that's Ok.

I didn't do any additional testing except what maven
does automatically. Given the simplicity of the
change, that seemed to be enough.

Let me know if you want me to post the Perl script or
you require anything else.

Thanks.
Manoj


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: [PATCH] log4j to commons-logging conversion

Posted by Tobias Strasser <to...@gmail.com>.
> I also tried removing the log4j dependency after this patch, but it
> resulted in quite a few unit test failures. It seems that at least the
> cqfs-jackrabbit package depends on log4j, so Manoj's patch doesn't yet
> fully remove the log4j dependency from Jackrabbit.
ok, we will see to remove those dependencies as well..
thanks again for providing the patch

cheers, tobi

-- 
------------------------------------------< tobias.strasser@day.com >---
Tobias Strasser, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97 
-----------------------------------------------< http://www.day.com >---

Re: [PATCH] log4j to commons-logging conversion

Posted by Manoj Prasad <ma...@yahoo.com>.
Hi Everyone!

Wow! I didn't expect that much discussion about my
patch.

First, for Stefan, my script is attached. There's a
usage description after the Apache notice. Let me know
if you have any questions.

Second, thanks Jukka, for answering Stefan's
questions. I couldn't have said it better myself!

Third, thanks again Jukka and also Jos, for providing
the "needs analysis" information in response to Ugo's
question.

Finally, I would like to share my bias regarding the
problems with commons-logging that Ugo pointed out:

"Given enough eyeballs, all bugs are shallow."
                              -Eric S. Raymond

Thanks.
Manoj


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

Re: [PATCH] log4j to commons-logging conversion

Posted by Jukka Zitting <ju...@zitting.name>.
Hi,

Ugo Cei asked:
> I have but one question: Why?

Jackrabbit is a content repository _component_ that various applications
can use for managing their content. It is quite likely that a main
application already uses an existing logging framework (not necessarily
log4j), and it would certainly be useful to utilize the same logging
mechanism also for the content repository component. Commons-logging
makes this possible.

Only the "Repository Server" deployment scenario makes Jackrabbit a
standalone application. Even then you might want to make the "Jackrabbit
application" more manageable by using some application framework (like
the late Avalon) with it's own logging mechanism.

Best regards,

Jukka Zitting



Re: [PATCH] log4j to commons-logging conversion

Posted by Jos Potargent <jo...@gmail.com>.
Stefan,

maybe this blog from its creator can answer your questions if you
should use it or not:
<http://radio.weblogs.com/0122027/2003/08/15.html>. This is the
interesting part:

<< 
The purpose of Commons Logging is not to isolate your code from
changes in the underlying logging framework. (That's certainly easy
enough to do on your own, and not really worth doing in the first
place given the ease of switching from one logging framework to
another.) The purpose of Commons Logging is not to somehow be more
useful than actual logging frameworks by being more general. The
purpose of Commons Logging is not to somehow take the logging world by
storm. In fact, there are very limited circumstances in which Commons
Logging is useful. If you're building a stand-alone application, don't
use commons-logging. If you're building an application server, don't
use commons-logging. If you're building a moderately large framework,
don't use commons-logging. If however, like the Jakarta Commons
project, you're building a tiny little component that you intend for
other developers to embed in their applications and frameworks, and
you believe that logging information might be useful to those clients,
and you can't be sure what logging framework they're going to want to
use, then commons-logging might be useful to you.
>>

So probably you could justify its use (if you see some other logger
frameworks else than log4j).

Regards,

Jos


On Wed, 16 Feb 2005 13:40:49 +0100, Stefan Guggisberg
<st...@gmail.com> wrote:
> On Wed, 16 Feb 2005 13:02:32 +0100, Ugo Cei <ug...@apache.org> wrote:
> > Il giorno 16/feb/05, alle 12:23, Jukka Zitting ha scritto:
> >
> > > Anyhow, I'd vote for applying the patch as I see no design or
> > > implementation problems with it.
> >
> > I have but one question: Why?
> >
> > Why commons-logging, I mean, with all the problems with classloading
> > and such [1,2] it has? Isn't log4j good enough?
> 
> i put commons-logging on the ToDo list because i thought allowing
> the user to choose the logging api woud be a good idea.  jackrabbit
> doesn't use any of the advanced features of log4j, the port would
> be straight forward (as manoj's patch proved)
> 
> but if the majority shares your concerns or if nobody is in strong
> favor of commons-logging i'd be happy to drop that todo item.
> 
> btw: what other apache projects are using commons-logging?
> 
> cheers
> stefan
> 
> >
> >         Ugo
> >
> > [1] http://www.qos.ch/logging/thinkAgain.jsp
> > [2] http://www.qos.ch/logging/classloader.jsp
> >
> > --
> > Ugo Cei - http://agylen.com/blojsom/blog/
> >
> >
> >
>

Re: [PATCH] log4j to commons-logging conversion

Posted by Stefan Guggisberg <st...@gmail.com>.
On Wed, 16 Feb 2005 13:02:32 +0100, Ugo Cei <ug...@apache.org> wrote:
> Il giorno 16/feb/05, alle 12:23, Jukka Zitting ha scritto:
> 
> > Anyhow, I'd vote for applying the patch as I see no design or
> > implementation problems with it.
> 
> I have but one question: Why?
> 
> Why commons-logging, I mean, with all the problems with classloading
> and such [1,2] it has? Isn't log4j good enough?

i put commons-logging on the ToDo list because i thought allowing 
the user to choose the logging api woud be a good idea.  jackrabbit
doesn't use any of the advanced features of log4j, the port would
be straight forward (as manoj's patch proved)

but if the majority shares your concerns or if nobody is in strong 
favor of commons-logging i'd be happy to drop that todo item.

btw: what other apache projects are using commons-logging?

cheers
stefan 

> 
>         Ugo
> 
> [1] http://www.qos.ch/logging/thinkAgain.jsp
> [2] http://www.qos.ch/logging/classloader.jsp
> 
> --
> Ugo Cei - http://agylen.com/blojsom/blog/
> 
> 
>

Re: [PATCH] log4j to commons-logging conversion

Posted by Ugo Cei <ug...@apache.org>.
Il giorno 16/feb/05, alle 12:23, Jukka Zitting ha scritto:

> Anyhow, I'd vote for applying the patch as I see no design or
> implementation problems with it.

I have but one question: Why?

Why commons-logging, I mean, with all the problems with classloading 
and such [1,2] it has? Isn't log4j good enough?

	Ugo

[1] http://www.qos.ch/logging/thinkAgain.jsp
[2] http://www.qos.ch/logging/classloader.jsp

-- 
Ugo Cei - http://agylen.com/blojsom/blog/

Re: [PATCH] log4j to commons-logging conversion

Posted by Jukka Zitting <ju...@zitting.name>.
Hi,

Nice job Manoj!

Stefan's comments:
> thank you very much for the patch! the changes look
> trivial enough but what i am a bit worried about is 
> the sheer scope of the changes as almost every 
> single file has been touched.

I checked through the changes and applied the patch to my source tree.
It also works without problems in my private RMI/XML test setup. (But
I'm not a heavy user of the logging features.)

I also tried removing the log4j dependency after this patch, but it
resulted in quite a few unit test failures. It seems that at least the
cqfs-jackrabbit package depends on log4j, so Manoj's patch doesn't yet
fully remove the log4j dependency from Jackrabbit.

Anyhow, I'd vote for applying the patch as I see no design or
implementation problems with it.

> one question that i have for example is about 
> configuration. how is commons-logging being
> configured?

See http://jakarta.apache.org/commons/logging/guide.html#Configuration

If no other configuration is given, commons-logging will first check if
the log4j classes are available and use standard log4j configuration.
Otherwise, if running on JVM 1.4+, then the standard JDK logging
mechanism is used. Finally a SimpleLog fallback is used if no other
logging mechanism is configured or available.

> also, i assume that log4j would not be a compile-time 
> dependency anymore, but still a run-time dependency.
> is that correct?

Yes, if you want to use log4j for the actual logging. You just include
log4j in the classpath and provide proper configuration. (Note however
the point about cqfs-jackrabbit.)

It's up to the user (or packager) to select the logging facility to use.

Best regards,

Jukka Zitting



Re: [PATCH] log4j to commons-logging conversion

Posted by Stefan Guggisberg <st...@gmail.com>.
hi manoj,

On Tue, 15 Feb 2005 19:30:43 -0800 (PST), Manoj Prasad
<ma...@yahoo.com> wrote:
> Hi,
> 
> I saw this mentioned in the ToDo.txt file and thought
> I would give it a try. I wrote a Perl script that did
> it all automatically except for LogPrintWriter.java
> which I updated manually. There is no API to "Level"
> in commons-logging, so I deleted it - please confirm
> that's Ok.
> 
> I didn't do any additional testing except what maven
> does automatically. Given the simplicity of the
> change, that seemed to be enough.
> 

thank you very much for the patch! the changes look
trivial enough but what i am a bit worried about is 
the sheer scope of the changes as almost every 
single file has been touched. i don't know much 
about commons-logging, only that it allows to use 
various logging services underneath. 

one question that i have for example is about 
configuration. how is commons-logging being
configured?

also, i assume that log4j would not be a compile-time 
dependency anymore, but still a run-time dependency.
is that correct?

> Let me know if you want me to post the Perl script or
> you require anything else.

posting the perl script would be great.

thanks again for your help, it's very appreciated.

cheers
stefan

> 
> Thanks.
> Manoj
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
> 
>