Oh my god man, could this be more fugly?

> Huh?
> 
> consider a user specific property called "wantDbLogging".
> 
>   Boolean wantDbLogging = (Boolean) data.getUser().getTemp("wantDbLogging");
>   Log log = LogFactory.getLogger(wantDbLogging.booleanValue() ? "dbLog" : 
>"normalLog");
> [...]
>   log.debug("foo");
> 
> I can even flip that boolean switch at runtime. 

So now all my components requiring logging have to be written to look at
that flag? Also, I have added coupling tun Rundata, User, and thus all
of turbine. Wahoo!

> (actual method names might vary slightly but you get the point).
> 
> Commons Logging is _NOT_ "write everything onto the class name based
> logger". This is just the most convenient approach.

Compare this to writing my class as a black box LogEnabled. If I want
the bugger to log to X, Y, Z, or whatever combination, I just hand it
the appropriate Logger, which might wrap commons-logging, log4j,
System.out, the bit bucket, or my evil twin's email account.

The component doesn't CARE whether I want DB logging -- why should it! 

-- jt


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

Reply via email to