A simple log file format

The 3 W's :

When, what and where.

For viewing something like multitail ("tail on steroids") http://www.vanheusden.com/multitail/

or for pure ms windows try mtail http://ophilipp.free.fr/op_tail.htm

And to keep your files readable, you might want to start new files when if the filesize of the current log file is over certain limit. Example:

  • activity0.log (1 mb)
  • activity1.log (1 mb)
  • activity2.log (1 mb)
  • activity3.log (1 mb)
  • activity4.log (205 bytes)

A fairly standard way to deal with logging from an application into a plain text file is to:

  • split the logs into different program functional areas.
  • rotate the logs on a daily/weekly basis (i.e. split the log on a size or date basis)
    • so the current log is "mylog.log" or whatever, and yesterday's was "mylog.log.1" or "mylog.ddmmyyyy.log"

This keeps the size of the active log manageable. And then you can just have expiry rules so that old logs get thrown away on a regular basis.

In addition it would be a good idea to have different log levels for your application (info/warning/error/fatal) so that you're not logging more than is necessary.