Let's Get Logging!

With Mach-II 1.6 already published as a stable release, a fair amount of focus has shifted to the development of 1.8 (Simplicity) and upcoming features such as the handy Environment and HTMLHelper properties, redirect enhancements, and more.

However, before too much focus shifts away from 1.5 and 1.6, I would like to remind Mach-II users about one feature in particular that should certainly not slip under the radar.

Mach-II 1.6 introduced a Logging package, which comes bundled with the framework, that is a real a treat to work with.  I can say from personal experience that as a relative newcomer to Mach-II, using the logging package was an absolute must.  The default logger provides a detailed look at exactly what happens throughout the life of your Mach-II requests, and can highlight everything from which events are announced in what order, to where your plugin points are being called, to exactly how many milliseconds each part of the request takes to process.  A real wealth of information is suddenly at your fingertips as the logger shows exactly what Mach-II is doing "under the hood."

Log Example

The icing on the cake here is that (by default) all this information is dropped out on the bottom of your view just by adding a single line of .xml configuration to your mach-ii.xml file.  Simply include the loggingProperty.xml configuration file, and you're off and running with the logger's smart defaults.  By tweaking the .xml configuration for the logging property you can easily configure a separate email logger to send emails (such as error alerts), or enable a CFLog logger which will write output to your CFML engine's log files.  Each logger is fully customizable by modifying the .xml configuration settings.

Perhaps most impressive to me about the logging package is the amount of detailed research that went into its design.  Believe me, I'm not patting myself on the back here (because I had nothing to do with it), I've just been fortunate enough use the package and see the positive impact it has had on my development experience.  In all seriousness, I do know that many hours were spent researching and evaluating existing logging packages before the engineering process for the Mach-II logging package ever began.  In fact, special care was taken to ensure that the loggers use industry standard logging levels, and have been designed completely independently of the Mach-II framework.  Yep, this means that the logging package can even be used just as effectively in non Mach-II applications as it can with Mach-II apps.

The last point I'll make is that the Mach-II dashboard (another vital tool for Mach-II development) has built-in functionality to make managing your Mach-II logging package even easier.  From the dashboard you can enable and disable different loggers, as well as controlling the logging level for each logger individually.  But don't take my word for it - if you haven't, take a few minutes to enable logging in your newest Mach-II application and see what you think!

If you'd like to read up on more of the specifics of plugging in the logging package into your application, check out this article on the Mach-II wiki

0 Comments  |  0 Trackbacks  |  Mach-II 1.6  |  Send
Posted 4/2/09 @ 8:45 AM by Brian FitzGerald