Log basics
Logs are basically messages produced by the system as it runs. These messages are produced by specific pieces of code as they are executed, allowing us to track actions happening in the code.
Logs can be completely generic, like "Function X is called" or can include some context of the specifics of the execution, like "Function X is called with parameter Y."
Normally, logs are generated as plaintext messages. While there are other options, pure plaintext is very easy to deal with, can be read easily, is flexible in its format, and can be searched with pure text tools like grep
. These tools are normally very fast and most developers and sysadmins know how to use them.
As well as the main message text, each log contains some metadata about what system produced the log, what time the log was created, and so on. If the log is in text format, this is normally attached to the start of the line.
A standard and consistent log format helps...