2009-05-28

Ruby log file management

I have been looking for a ruby log file management.  I looked at log4r but not sure it does what I want.  I am assuming a program that is run regularly to carry out a job. I would like the following:

1) for log files to be created for each run.  These to be stored in a log file directory

2) For the log files to be managed eg stored in log\2009\2009-04 and then a log file per day and a method of multiple log files per day.

3) The log files to have a format so that they are quite happy to crash in the middle, computer turned off and still be well formed and to have written everything that has been done out safely.  IE they can’t use regular XML format as can’t rely on closing brackets

4) Ideally have a graphical hierarchical tool to show you what happened.  Eg how long does something take over time, how often has it gone wrong.  A task would log start and end events. How many have happened per month etc  Looking at graphical environements this seems more suited to a rubyfx than shoes as rubyfx has support for a tree list.  Ideally the top levels of the tree would be the file directory structure.

5) The structure to cope with hierarchical logging eg

Start A
  Start B
  End B
  Start B
End A

Shows two B inside an A, on of the B’s was unsuccessful

6) Automatic log control eg ability to have only n Months of logs, to keep only say end of month logs after 1 year and even log thinnning where old logs are first thinned by getting rid of sub levels to take up less space.  Fixed space could also be used.

I think this is as far as I have got so far now back to some real work.

Later:  I have looked at YAML and think it is going to be helpful.

No comments: