ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Costin Manolache <cmanola...@yahoo.com>
Subject Re: commons logging q
Date Sat, 18 Jan 2003 16:35:52 GMT
Steve Loughran wrote:

> so its pretty easy to do an implementation of the commons log that sends
> the messages to ant at the appropriate level, but I am stuck at the
> factory
> 
> I need the current project (and preferably task) to set up the logger. I
> suppose for custom tasks (like the Axis ones) we just choose and set up
> the factory. But I know that the Axis code just calls LogFactory.getLog()
> , which retrieves a factory created by the standard commons algorithm, or
> that set by the system properties (and hence created with an empty
> constructor). And although the library caches the factory on a classloader
> by classloader basis, there is no way to put a manually created factory
> into the cache.
> 
> The only way I can see that works is
> 
> (a) set some static prop in our logfactory impl to point to the current
> project, maybe task
> (b) set the system property org.apache.commons.logging.Log  to our class
> (c) have the log factory get its data from the statics
> (d) write something to hide (a) and (b) from the general public out of
> embarassment.
> 
> Any other better solution out there?

Not sure what you need - we can save the LogFactory in an ant reference,
if you want all tasks to use the same factory.

Or we can add a set method to c-l that sets the LogFactory for the current
context. ( I don't think it should be the Thread, but the 
Thread.contextClassLoader() - so you can set it per webapp ). 

Something like 
 static LogFactory.setLogFactory( ClassLoader thCL, LogFactory f); 
Send a patch to commons, it seems a reasonable use case.

Costin


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


Mime
View raw message