[ic] error.log date format

Peter peter at pajamian.dhs.org
Sat Sep 12 23:30:45 UTC 2009


On 09/12/2009 06:29 AM, Mike Heins wrote:
> Quoting Peter (peter at pajamian.dhs.org):
>> On 09/12/2009 05:35 AM, Salvador Caball? wrote:
>>> El Saturday 12 September 2009 14:19:07 Peter va escriure:
>>>> On 09/12/2009 04:25 AM, Salvador Caball? wrote:
>>>>> I need to change the error.log date format, now is:
>>>>>
>>>>> [12/September/2009:10:02:00 +0200] but i need to change to:
>>>>>
>>>>> [12/Sep/2009:10:02:00 +0200]
>>>>>
>>>>> how can I change this?
>>>> This is hard-coded into the logtime() function, but you should be able
>>>> to override it, try the following in Interchange.cfg (I would recommend
>>>> putting this right at the top of interchange.cfg so that it gets loaded
>>>> as soon as possible):
>>>>
>>>> GlobalSub <<EOR
>>>> sub override_logtime {
>>>>         package Vend::Data;
>>>>         sub logtime {
>>>> 		return POSIX::strftime("[%d/%b/%Y:%H:%M:%S $Offset]", localtime());
>>>>         }
>>>> }
>>>> EOR
>>>>
>>>>
>>>> Peter
>>>>
>>> Thanks Peter
>>>
>>> I have the following error:
>>>
>>> Bad GlobalSub 'override_logtime': Global symbol "$Offset" requires explicit 
>>> package name at (eval 28) line 4, <GLOBAL> line 8.
>> Try this:
>> return POSIX::strftime("[%d/%b/%Y:%H:%M:%S %z]", localtime());
> 
> That's the way to do it. The previous one failed because it should have
> been in Vend::Util, not Vend::Data.

You're correct of course, I was half asleep when I wrote it.  But I
think it still would have failed in Vend::Util because $Offset is "my"
scoped (which, from memory, means that it's file scoped, not package
scoped).

Incidentally why the mess of code in Util.pm to get the same result that
%z would give anyways?

Salvador: you need to change Vend::Data above to Vend::Util or it may
cause problems.


Peter



More information about the interchange-users mailing list