Log4MT - A plugin for Movable Type v4 and Melody
- AUTHOR: Jay Allen, Endevver Consulting, http://endevver.com
- LICENSE: GNU Public License v2
- VERSION: 1.7
- DATE: 05/18/2010
The Log4MT plugin enhances Movable Type with the fantastic and ultra-powerful Log4Perl logging framework. Like Log4perl, Log4MT enables you to debug your code, handle exceptions or send notifications with one of six priorities (trace, debug, info, warn, error, fatal).
The output of those messages can go to any of the following:
- The webserver error log
- An arbitrary file
- Any database
- Any socket
- One or more arbitrary email addresses
- The syslog
- ...and many more!
What's more, with Log4MT you can completely control not only the formatting of those messages but also exert granular control over what messages should trigger output, which output methods they should trigger or which messages should be ignored altogether.
For an overview on Log4MT's capabilities, see the excellent overview of Log::Log4perl "Retire your debugger, log smartly with Log::Log4perl!"
1.7 (released May 18th, 2010)
- Movable Type 4.x or any version of Melody
- Log::Log4perl (included in the distribution)
- Log::Dispatch (included in the distribution)
- Sub::Install (included in the distribution)
This program is distributed under the terms of the GNU General Public License, version 2.
- Clone the repository or download the latest version and unpack the archive
- Copy the contents of the
extlibdirectories in the archive into the respective directories in your MT/Melody application directory. In the case of
extlib/MT, the directory already exists but the files being added are new.
- Copy the
log4mt.conffile to the root of your MT directory
- Modify the
log4mt.conffile to specify the desired absolute path to your log file. There are instructions inside the file which will guide you.
And that's it!
Using Log4MT in a basic way (i.e. to log messages to a file) is simple. Follow the installation instructions linked to above and then do:
# Instantiate the logger object from MT::Log my $logger = MT::Log->get_logger(); # Send information about this location to the logs $logger->trace(); # Just say howdy! $logger->debug('HOWDY!'); # Log some information to the log $logger->info('FWIW, this is interesting...'); # Warn about a possible issue $logger->warn('User doesn't have a display name: ', $author->name); # Report on internal errors and dump out objects or complex data $logger->error('Ran into an error saving entry: ', l4mtdump($entry)); # Log serious errors $logger->fatal(sprintf 'Application %s died with error "%s"', ref($app), ($app->errstr || $@));
For most users, the basic configuration is enough to get you started logging. If, however, you want to turn down the logging level without removing your logging statements or do some more exotic things, the log4mt.conf file is the heart of the an incredible amount of functionality.
Everything you can do with the config file to customize Log4MT is documented in the Log::Log4perl documentation.
- Retire your debugger, log smartly with Log::Log4perl!
- Log::Log4perl documentation
- The exhaustive Log::Log4perl FAQ
- POD documentation forthcoming
Full details can be found in the commit logs but briefly:
- 2010/05/18 - Release of v1.7
- 2008/11/03 - Release of v1.5
- 2008/04/03 - Release of v1.2 beta 2, small but critical bug fix in the configuration file
- 2008/04/02 - Initial public release of v1.2-beta