Henri Yandell wrote, On 07/02/2003 17.32:
On Fri, 7 Feb 2003, Nicola Ken Barozzi wrote:

Speaking as a potential user of commons-logging to your suggestions:


Look, I have some requirements that I'd like to be addressed somehow,
let's see if you can help me.

1) a library should be able to work even without commons-logging
   in the classpath

I don't see how this can work without ensuring that another package,
commons-stub is in the classpath. I know I'm definitely not going to copy
and paste pieces of code from library to library to handle looking for
commons-logging.
package org.apache.myproject;

public class Logger extends SafeCommonsLogger

I'm also not sure if this is possible in a way that will work in all JVMs.
I use a similar trick in the HEAD version of the String Taglib, basically
I have a static method call which checks to see if the necessary class is
available, this boolean is stored in a static variable which is checked
on each call to the method.

However I'm not sure if this will work on all JVMs. What if a JVM attempts
to pre-load all classes discussed in a class before loading the class,
even if the class being used is hidden inside a non-executing piece of
code.
I never saw this issue. If a class is not used, it's not used.
Anyway, you can use reflection.

2) it should be possible to pass the logger to the library instead
   of having it search for it via static accessors
Explosion of API. This is unnecessary overloading. Why isn't it simply
handled via a factory mechanism? Akin to JNDI.
Again... we don't want factory methods...

I'm not saying that you have to agree with me on IOC, just acknowledge that it's a reasonable thing to do. Heck, just one method, is it too much?

3) if commons logging is in the classpath and the logger is not set,
   then it can log only if an environmental variable based on
   the library package is set

Sub-clause of 2).
ditto

This means that if I want to log, I have to add an environmental
variable for every library I want to log, and put commons logging in the
classpath, or set the logger on each package I want to log.

What do you think? What of the above seems unreasonable to you?
All of the above :) Plus adding an envrionment variable per library is a
poor management technique. I want to store them all in a file, not as a
host of -D arguments or even in code.
Ok, the problem arises when a user has multiple of these files in the classpath. I've seen it happen more than once.

Poor management technique? I'm just talking about utility libraries.
As a user, do I ever have to manage logging, or even remotely have to deal with it?

I want to get XJar and use it. No logging, I'm not a developer. This is the use-case. Any other possible solution?

--
Nicola Ken Barozzi [EMAIL PROTECTED]
- verba volant, scripta manent -
(discussions get forgotten, just code remains)
---------------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to