At 08:06 AM 12/27/2004, Curt Arnold wrote:
Your change in version 1.6
of
if (millisecondStart != UNRECOGNIZED_MILLISECONDS) {
millisecondStart = findMillisecondStart(now, cache.toString(), formatter);
}to
if (millisecondStart >= 0) {
millisecondStart = findMillisecondStart(now, cache.toString(), formatter);
}indicate that we see eye to eye.
findMillisecondStart is not called again after the first time it returns UNRECOGNIZED_MILLISECONDS. I guess you could avoid calling it again if it detected NO_MILLISECONDS. I think a format like "HH:mm:s,SSS" would require you to reevaluate the millisecond position every second. To reduce the evaluations much beyond what we have now, the complexity and potential caching errors goes up with little additional performance gain.
to setting the system time back.
I was not only thinking of the if (slotBegin > time) { slotBegin -= 1000; } check. There are other places that assume slotBegin to only take positive values. For example, set setTimeZone method. As mentioned previously, I am happy to defer to your judgement.
Setting slotBegin to zero in setTimeZone is not sufficient to invalidate the cache. I'm guess this is an artifact of our friendly "duel", but maybe I got it wrong initially. Changing the timezone may also change the location of the millisecond field, so findMillisecondPosition should be called. It should look very similar to the body of the constructor.
Since you will invoke findMillisecondPosition() in the format() method, I can't think if a reason to include it in setTimeZone(). Anyway, your changes in 1.6 indicate that you share the same view. One could push it a little and remove the call to findMillisecondPosition() in the constructor and let the format() method fall on its feet. However, that may be a) pushing it a little b) splitting hairs c) or both.
p.s. I don't believe RelativeDateFormat is used anywhere in the log4j code base and should likely join AbsoluteDateFormat and the others in the "attic".
Yes absolutely. I will gladly support a proposal to that effect, or put it forth myself.
-- Ceki G�lc�
The complete log4j manual: http://qos.ch/log4j/
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
