Proposals:Logging

From KitwarePublic
Revision as of 15:36, 10 June 2007 by OekRts (talk | contribs)
Jump to navigationJump to search

cheap diazepam cheap xenical nokia ringtones qwest ringtones zanaflex online diazepam online verizon ringtones free motorola ringtones order lortab prozac online ericsson ringtones but ortho cheap cyclobenzaprine cheap celexa free ringtones phentermine free cool ringtones cheap prozac free qwest ringtones cialis online sprint ringtones nexium online real ringtones sagem ringtones tracfone ringtones free nokia ringtones free punk ringtones mp3 ringtones sony ringtones ativan online but hgh free midi ringtones alltel ringtones cheap flexeril sony ericsson ringtones motorola ringtones vicodin online free tracfone ringtones buy soma levitra online free motorola ringtones cheap didrex cheap sildenafil pharmacy online online zoloft online hydrocodone online free sony ringtones cingular ringtones viagra buy paxil ambien online buy lortab order hydrocodone vigrx online cheap ativan hgh online sildenafil online buy viagra ortho online nextel ringtones lisinopril free funny ringtones free sony ericsson ringtones buy vicodin hydrocodone order ativan mono ringtones clonazepam levitra free sprint ringtones cialis online sony ringtones cheap levitra zanaflex online phentermine celexa online ultracet online wwe ringtones free sharp ringtones buy norco soma online cheap ultracet free cingular ringtones cheap adipex cheap xenical cheap albuterol cheap tenuate cheap ortho free music ringtones sagem ringtones cheap lisinopril meridia online cheap propecia cheap vigrx cheap diethylpropion cheap albuterol mp3 ringtones meridia online free ringtones cheap ultram soma online cheap lortab cheap sildenafil free nextel ringtones cheap lorazepam free funny ringtones diethylpropion online free ringtones funny ringtones cingular ringtones cheap soma nokia ringtones clonazepam online zyban online clomid online buy prozac online valium order lisinopril meridia online buy tramadol sharp ringtones free midi ringtones flexeril online real ringtones celexa online zoloft online free nextel ringtones ericsson ringtones free music ringtones mtv ringtones order ultram buy valium viagra online lorazepam online cheap cialis cheap phentermine buy nexium samsung ringtones cheap norco meridia online sprint ringtones buy rivotril order carisoprodol carisoprodol online cyclobenzaprine online free qwest ringtones free qwest ringtones cheap fioricet verizon ringtones punk ringtones cheap hoodia pharmacy online online tracfone ringtones tramadol cheap rivotril tramadol online didrex online cheap fioricet music ringtones cheap albuterol free nokia ringtones buy viagra buy alprazolam buy xenical pharmacy online online free funny ringtones order zanaflex free ericsson ringtones cyclobenzaprine online adipex online cheap xanax free alltel ringtones free qwest ringtones ultram online sonyericsson ringtones free samsung ringtones cheap lortab free mono ringtones free samsung ringtones zyban online cheap celexa free funny ringtones wwe ringtones cheap rivotril but clomid buy fioricet buy hgh cheap lipitor cheap hoodia clonazepam online cool ringtones tenuate online cheap vicodin real ringtones free sonyericsson ringtones buy hoodia buy tramadol nextel ringtones cheap alprazolam ambien online = Requirements =

Current Status

Logging capabilities are currently available in ITK through very limited mechanism that involve the use of the following element

  • itkWarningMacro
  • itkExceptionMacro
  • TextOutput

Advantages

  • It is already there  :-)
  • It is fully implemented using ITK classes. We have complete control over the code
  • It is compact and easy to maintain

Drawbacks

The drawbacks of the current functionalities are

  • The TextOutput is by default sent to an OutputWindow that lacks an event-loop. It is then usually the case that users/developers dont have a chance to look at the error messages because they are scrolled rapidly and there is no way to get them back.
  • Messages are not send to files. Currently this could only be done by each developer creating a class deriving from the OutputWindow and redirecting the messages to a file.
  • Level of granularity. The current approach only have "ERROR" messages that are thrown through exceptions and warning messages.

Wish List of Logging Features

Here are the features that ITK developer would like to have available in a logging infrastructure

  • Possibility of selecting the level of granularity at run time
  • Possibility of sending logging messages to multiple destinations (files, sockets, console, GUI windows) some of them simultaneously
  • Suitable for being used in multi-threaded environments.
  • Possibility of selecting the objects that send logging messages
  • Possibility of having multiple receivers for the messages. e.g. several Logger instances
  • Formatting log messages in such a way that they can be sorted and greped later on
  • Possibility of adding time stamps to the messages
  • Integrate with ITK such that appropriate filters (optimizers, registrators) would provide a basic level of progress reporting that could be enabled/disabled at run-time.
  • Minimize performance impacts on the applications being logged. (important for release version of applications)
  • Possibility of limiting the size of a log file (for saving storage space)
  • Possibility of aging log files (for archiving)
  • Possibility of guaranteeing messages to be logged (important when messages are critical)
  • Possibility of loading an XML setting file at run time (level of granularity, destinations, format, etc.)
  • Possibility of having hierarchy of loggers and inheritance of settings (convenience of setting and managing loggers)
  • Possibility of having logger ID and being able to get and designate a logger with a specified ID (logger-wise run-time setting is possible, not application-wise)

Option of using Log4cxx

log4cxx is a logging package modeled on log4j, a popular logging package for Java.


Usage

Each class in ITK would have a static class variable pointing to a logger. The logger's are named, with the usual naming convention being org.itk.Code.Common.Object, essentially a namespace / Java package hybrid. Names define a hierarchy, so org.itk.Code is the parent of org.itk.Code.Common, org.itk.Code.BasicFilters, etc... There are different levels of log messages, debug, info, warn, error, fatal and log. The developer decides when and where to put a logging message, and it's severity.

At runtime, the application defines the threshold of messages to be logged, i.e. debug and higher, or info and higher. A logger inherits it's threshold from it's parent, if not specified. Thus it is easy to shut off logging messages from org.itk.Code all at once.

In addition to thresholds, different output options are available called Appenders. For instance:

  • Console: essentially std::cout
  • File: Log to a file
  • SMTP: Send email
  • RDBMS: Log to a database
  • RollingLogFile: Log to a file, roll to a new file at specified time/size

Documentation can be found on the log4cxx doxygen pages.

Impact to ITK

  • Augment the Error and Warning macros in ITK
  • Can be implemented in New and/or Type macro
  • Immediately available to all class developers
  • Flexible output options
  • Aid to debugging

Pros

  • Allow much more flexibility in logging messages
  • Easy configuration of logging structure
  • Applications can leverage feature
  • Can change logging options at runtime, not compile time

Cons

  • Static class variable per class. Experience have proved Singletons to be conflictive when dealing with shared libraries.
  • The library is in version 0.93. Its developers have gone through a refactoring process and the new version depends on a systems service library from Apache.
  • 30K lines of code to maintain
  • 2 Megabytes of source code
  • It wasn't supported in all the ITK platforms. It required substantial work to port it to all of them.
  • Need to work out default configuration
  • Run-time overhead (fairly minimal)

Proposed Plan

  • Check into Insight/Utilities
  • Write smoke test
  • Get test working on all platforms
  • Resolve integration issues (itkNewMacro / itkTypeMacro)
  • Replace Error / Warning Macros
  • Begin using in existing and new classes


Option of Writing our own

This option involves to develop a set of new ITK classes intended for providing the logging functionalities.

Pros

  • Complete control over the code
  • Only implements what we need
  • Focus on performance on the context of ITK uses

Cons

  • Potentially reinventing the wheeel

Potential Implementations

Adapt IGSTK classes

Sohan Rajan from the ISIS Center at Georgetown University has already develop a starting framework for providing logging capabilities. We could take these classes and extend them as appropriate in order to fulfill the needs of the ITK community.

Issues from Hee-Su(ISIS)

In addition to wish list update, here are some issues.

OS-independent timestamps

for datetime

  • vtkTimerLog : better but it's dependent on vtk
  • time(), strftime(), gmtime(), localtime(), asctime() : ANSI but 32bits

for real-time clock

  • QueryPerformanceCounter(), QueryPerformanceFrequency() : Win32
  • gettimeofday() : UNIX, Linux

Alternatives for guaranteeing messages to be logged

  • flush to a disk immediately (slow, overhead on a disk)
  • run a separate logging service and forward messages to it. (slow because of IPC)
  • flush manually by a programmer
  • flush automatically when the level of message is above certain level. (e.g. CRITICAL, ERROR)
  • don't care (do nothing)
  • user could set an option for this. but option checking(if-then) might reduce performance.



ITK: [Welcome | Site Map]