james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter M. Goldstein" <peter_m_goldst...@yahoo.com>
Subject RE: [PATCH] POP3Handler.java v.2
Date Mon, 05 Aug 2002 18:23:58 GMT


> Feedback 1
> ==========
> instead of doing
> out.println(...)
> logResponseString(...)
> Would it better to override <println> to log ?
> At the time of PrintWriter creation in <compose>, log level could be
> checked
> and a Loggable PrintWriter created. This may be cleaner and may avoid
> multiple calls to <logResponseString> and check for
> if (getLogger().isDebugEnabled())
> in <logResponseString>

It's an interesting idea, although there's at least one serious problem
with this suggestion.  In short, not every response goes to the log.  If
we tried to merge the output stream with the logging stream then we'd be
sending all data (returned messages, etc.) to the log, which is not what
we want to do.  What we want to do is record the commands sent back, not
the entirety of the data sent back to the client.  Keeping the writers
separate is a result of this requirement.

I'm also not nuts about caching the log level.  The reason for this is
that I don't see anywhere in the Logger contract a guarantee that the
log level will remain unchanged for the life of the server.  I can
certainly think of a number of situations where I'd like to be able to
change the log level midstream, and I suspect that at least one future
logging implementation will allow that behavior.  The cost of what, in
the overwhelming majority of cases, will be calling a method that just
returns a Boolean cached in the logger is fairly minimal.  If I'm wrong
about the Logger contract I'd be happy to implement a variant of this
optimization.  If not, I value obeying the contract over a minor
performance enhancement.


To unsubscribe, e-mail:   <mailto:james-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:james-dev-help@jakarta.apache.org>

View raw message