Thursday, August 16, 2007

The Big Three at the start of a Project

cue flashback effects......

revisiting a few topics from an old post, I was reminded today about some of the things that can make or break a project, that some thought at the start can alleviate much suffering.

Things your logging system needs to do:

  1. be dynamic - you must be able to change logging levels on the fly without stopping any processes
  2. be granular - you need to be able to segregate the severity of the log messages, so that you can eliminate detail as necessary (more on this below)
  3. be muxable - you need to be able to route log messages to multiple different sinks - syslog, files, another server, etc
  4. have a strong locality to the messages - know where they come from - process. thread. date. time. function, etc.
Things your configuration system needs to do:
  1. be compact - have your configuration be in one place, a file or a DB
  2. be dynamic, unless absolutely impossible - you want to be able to change config on a running process.
  3. be contained in one function, so that if you trigger a reconfig, only one call needs to be made.
Things your feature setup needs to do:
  1. be configuration-driven - you don't want to require a rebuild to enable a feature.
  2. use the Factory pattern, and feature flags to drive it - so you can have one code stream.
  3. have a single code interface to determine if something is in use - do not have an "enabled" function and a "licensed" function and an environment variable to set things.
Logging is a really big thing - some people prefer a levelled system, some prefer a bitmapped system. I have suggested a combined system - a level system for the basic part, and a bitmapped section for spheres of concern, like network access, database access, etc. An alternative is to have a keyword filter, so that you can filter on keywords as well as levels.

One logging idea that I have not yet fully fleshed out is a class-based logging - where every class has a logging flag that can be set so that you can log everything that instances of a given class does.




Technorati Tags --
, , ,
HTTP