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?


1 answer

Doug 1095
  • Cookie: Since you're programming the web app, why can't you program it to generate any data/errors/etc. before you send any content to the browser?
  • Database: You could look into using SQLite for a database that has a lower bar for setting up, and there are various database abstraction layers available that do the heavy lifting of connections, query statements, etc.
  • Hidden form inputs: To be sure the hidden fields are always submitted, include them inside any forms on the page. How hard is it to output identical text multiple times?
Answered almost 7 years ago by Doug
  • @Doug, really valid points you have there. +1 o.k.w almost 7 years ago