Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debug Levels when writing an application

Tags:

I would like to know if you guys have any suggestions about debug levels when writing an application.

I thought about 4 levels:

0 : No Debug
1 : All inputs and outputs
2 : "I am here" notification from significant functions with main parameters
3 : All variables verbose

like image 680
Omri Avatar asked Nov 23 '08 10:11

Omri


1 Answers

Here's what we did in one project I worked on. It's not the bible of logging levels, just one possibility. Logging should be fitted to your situation.

  • LOG_SEVERE, severe errors that require program exit (e.g., in an application, you ran out of disk space).
  • LOG_ERROR, error messages that can't be recovered from but the program can continue to run (e.g., in a server application, client sent through bad data but other clients can continue to run).
  • LOG_WARNING, recoverable problem that you should be notified about (e.g., invalid value in a configuration file, so you fell back to the default).
  • LOG_INFO, informational messages.
  • LOG_ENTRY, log entry and exit to all functions.
  • LOG_PARM, log entry and exit to all functions with parameters passed and values returned (including global effects if any).
  • LOG_DEBUG, general debugging messages, basically useful information that can be output on a single line.
  • LOG_HIDEBUG, far more detailed debugging messages such as hex dumps of buffers.

Each level also logged messages in 'lower' levels. There was sometimes a question as to whether a debug message should be LOG_DEBUG or LOG_HIDEBUG but we mostly based it on the number of lines it would push out to the log file.

like image 107
paxdiablo Avatar answered Oct 07 '22 03:10

paxdiablo