I have a cgi web program (in C) that prints out different error messages to a log file. If the program is run again and runs into he same error, I do not want the same error message to log again. I’m looking at different options and any advice is appreciated. Thanks.
-Cookie: unable to set cookie after the html <head> section has been printed out.
(After the head section is where any errors would occur.)
-Database: Do not have one. Too much overhead for this issue to install one.
-Parse log file: Many other processes are writing to this log file.
-Hidden form inputs on html file: Seems messy. Have 3 different forms on the same html page. How do am I sure the hidden fields are always submitted regardless of which form is submitted? But one of the errors is when the html can not be produced, so can not depend on this.
Thanks.
The other option is to create some form of temporary file wherever you are able (not sure about permissions) and read that pre doing any work. Simply list the error types and optionally times in there, perhaps? This is assuming you want to persist this behaviour across runs of your program. This is the database solution without the database, really, so I’m not sure how helpful that is.
Whenever I mention database solutions without databases I always have to mention SQLite which is a file based serverless SQL “server”.