[Insight-developers] Re: ITK Logger Bug

Luis Ibanez luis.ibanez at kitware.com
Tue May 15 18:53:37 EDT 2007


Hi Patrick,


             Thanks for pointing out this bug.


I just committed to ITK a fix for it, removing the %R specifier.

For convenience, we also added to the itk::LoggerBase a method
where you can provide the text format of your choice.


The usage is:

       logger->SetTimeStampFormat( itk::LoggerBase::HUMANREADABLE );
       logger->SetHumanReadableFormat("%b %d, %Y, %H:%M:%S");


The default format is set to:

         "%Y %b %d %H:%M:%S"

So that it gets naturally sorted.



   Please let us know if you encounter any problems,


     Thanks


        Luis



--------------------
Patrick Cheng wrote:
> Hi Luis,
> 
> The error message is because the strftime() function doesn't recognize 
> the "%R" format.
> 
> If you could change the itkLoggerBase.cxx line 77, the format string to:
> 
> "%b %d, %Y, %H:%M:%S"
> 
> This function call will work. and it will output a string look like this:
> 
> May 15, 2007, 15:53:54
> 
> Thank you,
> 
> Patrick
> 
> 
> 
> Luis Ibanez wrote:
> 
>>
>> Hi Patrick,
>>
>> Thanks for pointing this out.
>>
>> Andinet is in vacations this week.
>>
>> We should be able to fix the submissions
>> from his machine (Tigris) early next week.
>>
>>
>>   Thanks
>>
>>
>>      Luis
>>
>>
>> ----------------------
>> Patrick Cheng wrote:
>>
>>> Hi Luis,
>>>
>>> I am trying to update the ITK on the windows build machine here, so 
>>> we can see the results on dashboard.
>>>
>>> I noticed that most of the tests on "tigris.­kitware" failed in the 
>>> past few days. The version of the ITK on that machine is May 11, 
>>> 2007, I think it does not take the fix of the missing "break", so 
>>> it's calling the itksys::SystemTools::GetCurrentDateTime("%Y %b %d %R 
>>> %S"), which causes most of the tests to fail.
>>>
>>> We should:
>>> 1. update the ITK code on all build machines
>>> 2. add a test case in IGSTK,
>>>    SetTimeStampFormat( itk::LoggerBase::HUMANREADABLE );
>>>    So we can see whether this new feature works or not.
>>>
>>> Could you help take a look at this?
>>>
>>> Thank you,
>>>
>>> Patrick
>>>
>>>
>>>
>>> Luis Ibanez wrote:
>>>
>>>>
>>>> Hi Patrick,
>>>>
>>>> Thanks for pointing this out.
>>>>
>>>> You are right, "break"s were missing
>>>> from the switch statement.
>>>>
>>>> A fix has been committed now.
>>>>
>>>> A test case was added to itkLoggerTest.cxx.
>>>>
>>>> I couldn't reproduce the problem you reported
>>>> with the Exception. Maybe we should experiment
>>>> with other combinations of the format string.
>>>>
>>>>
>>>>
>>>>    Luis
>>>>
>>>>
>>>>
>>>> -----------------------
>>>> Patrick Cheng wrote:
>>>>
>>>>> Hi Luis,
>>>>>
>>>>> Thank you for the fix. However I found two problems:
>>>>>
>>>>> 1) in itkLoggerBase.cxx line 73, there should be a "break"
>>>>>
>>>>> 2) My system doesn't seem to support this call:
>>>>>    itksys::SystemTools::GetCurrentDateTime("%Y %b %d %R %S");
>>>>>    It throws an exception as in attached image.
>>>>>
>>>>> Patrick
>>>>>
>>>>> Luis Ibanez wrote:
>>>>>
>>>>>>
>>>>>> Hi Patrick,
>>>>>>
>>>>>>
>>>>>> 1)  Thanks for pointing out this bug in ITK.
>>>>>>     A fix has now been committed for it.
>>>>>>
>>>>>>
>>>>>> 2) The functionality of writing out the time
>>>>>>    in a human-readable format has also been
>>>>>>    added to the itkLoggerBase class. You will
>>>>>>    have to update your ITK checkout in order
>>>>>>    to get this functionality.
>>>>>>
>>>>>>
>>>>>>    You should call in your logger the method:
>>>>>>
>>>>>>       logger->SetTimeStampFormat( itk::LoggerBase::HUMANREADABLE );
>>>>>>
>>>>>>    to get the time stamp in the format
>>>>>>    year, month, day, hours, minutes, seconds.
>>>>>>
>>>>>>    or you could call
>>>>>>
>>>>>>       logger->SetTimeStampFormat( itk::LoggerBase::REALVALUE );
>>>>>>
>>>>>>    in order to get the standard behavior, printing the
>>>>>>    time stamp in milliseconds.
>>>>>>
>>>>>>
>>>>>>
>>>>>> If you have a chance,
>>>>>> please give it a try and let us know if you find any problem.
>>>>>>
>>>>>>
>>>>>>
>>>>>>     Thanks
>>>>>>
>>>>>>
>>>>>>        Luis
>>>>>>
>>>>>>
>>>>>>
>>>>>> --------------------
>>>>>> Patrick Cheng wrote:
>>>>>>
>>>>>>> Hi Luis and Andinet,
>>>>>>>
>>>>>>> There is a minor bug in itkLoggerBase.cxx line 62
>>>>>>> I believe the third string should be "CRITICAL" instead of 
>>>>>>> "ERROR" according to the enum.
>>>>>>>
>>>>>>> Could you guys also add the feature of logging formated time 
>>>>>>> early next week? I really appreciate it.
>>>>>>>
>>>>>>> 4989 igstkLogMacro() & TimeStamp should output time in brokendown 
>>>>>>> date/time, instdead of milliseconds. Have both options, 
>>>>>>> milliseconds for easy computation, and broken down time for 
>>>>>>> readability
>>>>>>>
>>>>>>> Thank you.
>>>>>>>
>>>>>>> Patrick
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------ 
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>
>>
>>
>>
> 


More information about the Insight-developers mailing list