I sent this message a little while ago, but I was not then a member of the
mailing list. I got no response and do not see it in the archives, so I can't
tell if it's awaiting some sort of moderator approval, or it just got tossed
into the trash. I've joined the list and am trying again. I apologize for any
duplication(s) caused.
----------------------------------------------------------------------
In DateFormat.pm, the routine fmt() should not bother to recreate the time
string over and over and over....You tend to see the same timestamp on numerous
consecutive log entries (unless you're using milliseconds, which seems like
overkill in many situations). Anyway, the code should be something like:
{
my $lastSecs = 0;
my $lastMsecs = 0;
my $lastFmt = '';
###########################################
sub format {
###########################################
my($self, $secs, $msecs) = @_;
$msecs = 0 unless defined $msecs;
return $lastFmt if ($lastSecs == $secs and
$lastMsecs == $msecs);
my @time;
if($GMTIME) {
@time = gmtime($secs);
} else {
@time = localtime($secs);
}
# add milliseconds
push @time, $msecs;
my @values = ();
for(@{$self->{stack}}) {
my($val, $code) = @$_;
if($code) {
push @values, $code->($time[$val]);
} else {
push @values, $time[$val];
}
}
$lastSecs = $secs;
$lastMsecs = $msecs;
$lastFmt = sprintf($self->{fmt}, @values);
return $lastFmt;
}
}
------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
log4perl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/log4perl-devel