Application Logging that Actually Helps
An Application Logging tool built atop CouchDB via CouchApp.
Applications usually needs to maintain activity logs of some sort. Usually this is accomplished through a flat file with each line containing 1 unique entry. If you're really sophisticated, you will have a database (like MySQL) that stores your log information.
Both methods work fine, until of course you need to do some real troubleshooting. How much useful information can you put into 1 line of a text file? (while still maintaining readability) How complex would a relational data-model be if you need to store meta-data that differs in structure for most different entries you make?
CouchLog leverages the schema-less, document-oriented approach that CouchDB uses, enabling you to store useful debugging information into every log entry.
- CouchDB's RESTful API cuts out several layers usually required by Database-Driven Applications.
- There is no need for a specific driver to communicate with the database (any language that can operate with HTTP will do)
- Since HTTP is the interface for CouchDB, it is stateless and thus requires no prolonged connection to the database server
- JSON is a lightweight data-interchange format, greatly reducing necessary bandwidth and overhead
The CouchApp Interface allows you to quickly and easily filter through many log entries at once, greatly enhancing efficiency and reducing headaches when you need to debug or troubleshoot your applications.
Entries are made by sending a new Document to the CouchDB database.
{
"application": "My Application",
"section": "User Activity",
"level": "Notice",
"timestamp": 1263062089.44
"message": "User Login Recorded",
"data": {
"username": "testuser",
"source": "homepage"
}
}
- application - An identifier for your particular application
- section - The segment of your application that is recording the log entry
- level - A "severity" level of the log entry
- timestamp - A Unix timestamp (Example above is in PHP
microtime(true)
format) - message - A subject line for the log entry
- data - The meta-data associated with this log entry
You can use the CouchLog User Interface to browse through your applications log entries, filtering by date, application, section and level.
$ git clone git://github.com/desdev/CouchLog.git
$ cd CouchLog/couchapp
$ couchapp init
$ couchapp push applog