commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorbjørn Ravn Andersen <thunderax...@gmail.com>
Subject Re: commons logging class level logging
Date Wed, 30 Mar 2005 18:56:31 GMT
Trenton D. Adams wrote:

> Ok, is there a way of my wrapper class starting up, and automatically 
> detecting all the classes available in every package I specify, and 
> then setting up loggers for each one?  I mean an easy way.  I could 
> just search through all the files, and convert them to class names 
> without the '/' or '\'.
>
> If I could do that, then each class could call "log (message, 
> classname)".
>
> Either that, or I could just have the wrapper class setup a static 
> hashtable of loggers.  When a new log request comes in, I can check 
> the classname that's passed into the log method, and use it as lookup 
> into the hashtable of loggers.  If it's not there, make it and add it.

There is nothing wrong with you creating a utility class that does 
exactly that (except you probably want to pass a class instead of a 
classname - so you can pass "this" - which you then get the name for).

You may also want to investigate how JUnit discovers its testmethods.

-- 
  Thorbjørn

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message