commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Berin Loritsch <>
Subject Re: [Logging] [VOTE] Commons Logging 1.0 Release
Date Wed, 30 Jan 2002 16:20:25 GMT
Craig R. McClanahan wrote:

> On Wed, 30 Jan 2002, Geir Magnusson Jr. wrote:
> I might want to write my own "in between" wrappers (application specific)
> that are object-aware, and that then pass the message on to the underlying
> logging system.

Cocoon accomplishes this for logging the Environment object by using a method
that serializes all the information in a controlled manner.  The Object method
does have a potential problem if the Log Target is hostile and decides to
change program flow.

It is the same issue with bad "assert" writing.  Logging should not be able
to alter program flow, and neither should asserts.

> Turn the question around, as well.  What is the technical benefit in
> changing the argument to String?

The technical benefit is one of safety.  Application specific code is
kept in the application, and not in the abstraction.  Also, in the example
you listed, you would have to write the *same* abstraction for *every*
logger wrapper.

Then there is the issue of speed.  If you start with Strings, you don't
have to undergo the expensive toString() function.

Lastly, we have a benefit in a well defined contract.  It is not clear
what should happen if I pass any arbitrary object.  Should I expect to
see a message like this: "org.apache.tomcat.servlet.HttpServletImpl@4321553"?
When you limit it to Strings, there are no surprises later on.

> Can we please cut the personalities crap and talk about technical things
> for once?  Even with smiley faces, this is getting pretty old.

+1000  I agree completely.

Those are some of the reasons why we limit logging to Strings.


"They that give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
                 - Benjamin Franklin

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

View raw message