Thursday, June 17, 2010

Logging mechanism

Make sure the application has a logging mechanism. Consider the following while designing and implementing the logging functionality
  • Log only the exceptions which can not be handled by the end user and provide proper guidance for the end user to report the same.
  • Logging functionality shall be controlled through external configuration for enabling and disabling.
  • Alternatively the logging functionality shall be controlled through different build configurations like debug build with logging enabled and release build with logging disabled.
  • Logging mechanism for debugging the code (code flow) has to be disabled in the production version. The logging can be enabled if any crash is reported in the production version.
  • Do not use text file logging mechanism for recording audit trail information (user actions, transactions, etc.) instead use a database.
  • If the logs are recoded in test files consider a proper archival mechanism, so that the log file does not grow to the extend which can not be opened by any text file viewer.
  • Logging functionality has to be thread safe so that it can be used in multiple threaded application.
  • If the log information can be sent to an UDP port, then an UDP client application can be used for viewing the log information online.Overall this can make the debugging process very effective. Also this approach can be used for remote debugging if possible.
  • Make sure the logging functionality is optimized to the maximum.

Rule: Have logging mechanism for the application.

No comments: