Log handling
Log handling is a very important concept, and we will explore some of the many options, such as the ELK (Elasticsearch, Logstash and Kibana) stack.
Traditionally, logging just consisted of using simple print statements in code to trace events in the code. This is sometimes called printf-style debugging, because you use traces to see how your code behaves rather than using a regular debugger.
Here is a simple example in C syntax. The idea is that we want to know when we enter the function fn(x) and what value the argument x has:
void fn(char *x){ printf("DEBUG entering fn, x is %s\n", x); ... }
From the debug traces in the console, you can determine whether the program being developed is behaving as expected.
You would, of course, also like to see whether something serious is wrong with your program and report that with a higher priority:
printf("ERROR x cant be an empty string\n");
There are several problems with this style of debugging. They are useful when...