This sounds like exactly what you want:

http://jakarta.apache.org/commons/logging.html

Although you should read Ceki's comments on it:

http://marc.theaimsgroup.com/?l=jakarta-general&m=101720213502190&w=2


--Jeff

On Wed, Apr 17, 2002 at 12:45:21PM +0100, Rob Walker wrote:
> I've written a utility class and I'd like to include log4j calls for diagnostic and 
>error 
> logging.
> 
> Problem is this:
> 
> (i) At compile time, I can be sure the log4j.jar will be present.
> 
> (ii) At runtime, depending on who's using my class log4j either may not be 
> present or may not be configured.
> 
> I'd like to make my utility "smart" so that it can detect (ii) and either shut-up, 
>or 
> just log out to System.err/out.
> 
> My thought was to try an initial Logger creation and catch class not found 
> exception, which would seem to handle the "not present" case. Not sure if this 
> will work, and whether there's any easy way to handle the "not configured" case 
> (less of a problem since I could skip this step and assume that if log4J is present, 
> then it should be configured).
> 
> Anyone got thoughts on this?
> 
> -- Rob Walker
> SoftSell Business Systems, Ltd.
> ' testing solutions for a changing world '
>  
> +44 (20) 7488 3470
> www.softsell.com
> [EMAIL PROTECTED]
> 

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

Reply via email to