Application Logging

Application Logging is an important tool used by System Administrators and fellow developers to isolate production issues. While logging is a standard practice today, Developers don't fully appreciate the importance of standardizing the types of log messages, documenting them, and possibly providing scanning tools so that system administrators can diagnose and recover application issues in a production environment,

Here are some basic concepts:

1) Take advantage of log priorities often used by general log components. Many support different levels including Info, Debug, Warn, and Critical. Develop standards for your application.
2) Create ID numbers for all your log output. This makes it easier to develop an out-of-application knowledge base further defining the log message and how it should be treated.
3) As a general rule, its good to log things before and after each transaction. This makes it easy to track a particular workflow.
4) If you're working with a component or object oriented code base standardize your log messages to include classes and methods.
5) If this is a multi-user application, include an ID (session ID for example) for the running user.
6) Do not include private/security critical info in logs.
7) Keep in mind that logging does slow the app down and does use up disk space. Watch out for loops or other operations that occur very frequently and log only what is necessary.
8) Docuement the log information and provide your system administators with enough information on how to scan the log for issues.
9) Better yet, develop the appropriate scripts that parse the log proactively and alert on key issues. Another approach is to scan the logs nightly and develop aggregate statistics.
10) Review logs periodically and adjust alert levels for areas of the code that are stable.

No comments:

Post a Comment

Comments on this blog are moderated and we do not accept comments that have links to other websites.