Logfile

From Jonathan Gardner's Tech Wiki
Jump to: navigation, search

Logfiles are a special kind of file that record the operation of a program. It's kind of like debugging, but from a different perspective.

When you are using logfiles, you allow yourself to put on a detective hat and figure out what went wrong after it went wrong.

Generally, you add messages to the log files that give you hints about what is going on. When things start to get interesting--usually around error conditions--you become even more verbose and explicative.

The are two problems with logfiles:

  • They can grow too large and consume the free diskspace on the system. When diskspace is gone, you get a disk full error, which is really, really bad. You can have a method of logging that stores the log messages on a remote host with
  • Logging can slow down operations because you are limited by how fast you can write your log messages. To solve this, some systems have an asynchronous method of logging where the log messages aren't synchronously written to disk.