Hi Marco,

That sounds like a fine solution to me -- the end result is the same, which
is all I'm after. :)

Regards,
Clay

-- 
Killersoft.com



> From: "Marco V." <[EMAIL PROTECTED]>
> Reply-To: Log4PHP User <log4php-user@logging.apache.org>
> Date: Wed, 25 Jan 2006 14:38:16 +0100
> To: Log4PHP User <log4php-user@logging.apache.org>
> Subject: Re: Configurable msec separator
> 
> Hi Clay,
> 
> The LOG4PHP_LOGGER_PATTERN_MSEC_SEPARATOR can be useful.
> IHMO, it's better to define it before
> $GLOBALS['log4php.LoggerPatternConverter.spaces'] declaration.
> 
> with something like this:
> 
> /**
>  * Phpdoc comments here...
>  */
> if (!defined('LOG4PHP_LOGGER_PATTERN_MSEC_SEPARATOR')) {
>     define('LOG4PHP_LOGGER_PATTERN_MSEC_SEPARATOR', ',');
> }
> 
> and use it without $msecsep.
> What do you think about this approach ?
> 
> -Marco
> 
> ----- Original Message -----
> From: "Clay Loveless" <[EMAIL PROTECTED]>
> To: <log4php-user@logging.apache.org>
> Sent: Monday, January 16, 2006 8:08 PM
> Subject: Configurable msec separator
> 
> 
>> Hello,
>> 
>> I would like to see a patch like this applied to the Log4php package, in
>> helpers/LoggerPatternConverter.php:
>> 
>> --- LoggerPatternConverter.php      2003-12-09 14:50:14.000000000 -0800
>> +++ LoggerPatternConverter.php      2006-01-16 11:00:09.000000000 -0800
>> @@ -286,7 +286,8 @@
>>      {
>>          $timeStamp = $event->getTimeStamp();
>>          $usecs = round(($timeStamp - (int)$timeStamp) * 1000);
>> -        $this->df = str_replace("\u", "u", ereg_replace("[^\\]u",
>> sprintf(',%03d', $usecs), $this->df));
>> +        $msecsep = defined('LOG4PHP_LOGGER_PATTERN_MSEC_SEPARATOR') ?
>> LOG4PHP_LOGGER_PATTERN_MSEC_SEPARATOR : ',';
>> +        $this->df = str_replace("\u", "u", preg_replace("/[^\\\]u/",
>> sprintf("{$msecsep}%03d", $usecs), $this->df));
>>           
>>          return date($this->df, $event->getTimeStamp());
>>          
>> 
>> ... Basically, I'd like to be able to easily define what the msec separator
>> is when I request msecs in my log configuration.
>> 
>> The patch above allows for that level of configuration, without breaking
>> backwards compatibility for those who expect a comma to be the separator.
>> 
>> The patch also replaces ereg_replace() function with the faster
>> preg_replace() version.
>> 
>> 
>> What do you guys think?
>> 
>> Regards,
>> Clay
>> 
>> -- 
>> Killersoft.com
>> 
>> 
>> 
>> 


Reply via email to