Martin Desruisseaux ha scritto:
> Andrea Aime a écrit :
>> The way seems to use
>> Logging.setLoggingFramework(LoggingFramework.LOG4J). Now, I find
>> this a little convoluted, why can't we set the log factory directly
>> (making it a public class of course).
> 
> I was not sure how it would behave if Commons-logging or Log4J JARs are not in
> the classpath. In the old implementation, it threw NoClassDefFoundError. In 
> the
> new implementation, I'm not sure since LoggerFactory is an additional level of
> indirection.
> 
> I suspect that it may be JVM implementation-dependent. If we let users invoke
> setLoggerFactory(...) themself, then they have to handle ClassDefNotFoundError
> themselves too. The LoggingFramework stuff was an attempt to take care of this
> task. Note that the implementation use reflection (there is no "real" 
> reference
> to Log4JLogger or CommonsLogger anywhere), so we should not have any trouble 
> if
> Commons-logging or Log4J is not in the classpath. I'm not sure that we have 
> this
> garantee if we make "real" references to the Log4JLogger class.

I understand the problem, but I have the feeling the extra code 
complexity added by that code is worse than then problem it tries
to deal with.
We just have to declare the class cast exception or declare a custom
exception that the factories will throw if they cannot configure 
themselves... I mean, it's nothing strange and if I'm trying to force
Log4j I would like to be informed the hard way that it did fail, not
have code giong on without telling me anything (since anyways it's a 
classpath issue, so something you should be able to fix while creating
the app).

Cheers
Andrea

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to