Three Kinds of Logging
Today I’m sharing a readers response from Mark as a followup to the topic of application logging I presented learlier this week. Mark explores three kinds of logging…
Mark Writes:
I tend to group logging into 3 main categories that I treat differently through bespoke logging libraries. I would be keen to see what logging frameworks are available, but I think “what” is logged is probably more important than “how” it is logged.
- Data modification logging – Logging data changes within the database
- When to implement: This is often required when a trace is required of which user made what changes within the database. As this is often independent from application logic it can even be added after an application is put into production.
- How I implement: I tend to manage this directly in the database with a central logging table and triggers on each data table implicated.
- Application activity logging – Logging application activity that may be pertinent to system administrators/business units
- When to implement: This is probably the most unique to each project and thus must be designed within each application.
- How I implement: I tend to manage these logs in the application layer and report to a custom application log in the Windows “Event Viewer” on the application server. This way system administrators, without access to the application and/or database, may still see information that may be pertinent to them. Of course, depending on the amount of activity to be logged a traditional time stamped set of text or XML log files may be a better option to handle large logs, but I tend to try and restrict activity logs to only the most pertinent information unless a debugging mode is activated.
- 3. Error logging – A necessary evil for when things don’t go as expected
- When to implement: Apart from unexpected bugs in code execution, this is particularly important when an application must interact with external systems (i.e. email servers, other databases, etc.). Therefore, whilst I have often added this to existing applications after they are already in production, it would be most efficient to integrate this during application development.
- How I implement: Again I tend to favour a custom application log in the Windows “Event Viewer”, so that system monitoring systems can easily alert to errors that might not be immediately evident.
Do you have more to add to the conversation? If so, feel free to add your comments below, or drop an email to btaylor@sswug.org.
Cheers,
Ben
$$SWYNK$$
Featured Article(s)
First, You Must Define Data Integrity…
The term "data integrity" can mean different things to different people… and depending on context. At the top level, there are two aspects of integrity with respect to databases: database structure integrity and semantic data integrity.
Featured White Paper(s)
Key Considerations in Evaluating Data Warehouse Appliances
read more)
Featured Script
DeleteLoginsWithNoUser
The script deletes login that have no user in any of the server’s database…. (read more)