commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorbjørn Ravn Andersen <>
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.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message