Spotlight on Log4CF From DRK4

For those not in the know, the DevNet Resource Kit (DRK) Volume 3 and Volume 4 are now available to subscribers and non-subscribers alike. Although DRKs are now available immediately to the general public, you can still save yourself some money by going the route of a DevNet subscription.

DRK 4 has a ton of cool ColdFusion content, but I want to start off talking about Log4CF. Here is the description from the Macromedia website:

Log4CF is an extremely flexible and powerful logging framework that integrates into ColdFusion’s existing logging facilities. Leave logging and debugging code in your applications, even during production, and dynamically configure the verbosity of your applications’ log messages.

If you ever use the CFLOG tag, you will love Log4CF. First of all, it integrates perfectly with the ColdFusion administrator. The log files Log4CF creates automatically show up in the ColdFusion Administrator’s log manager where they can be archived, downloaded, deleted or viewed just like any other log file. A different log file is automatically created for every application.

The Log4CF manager also integrates with the ColdFusion Administrator, allowing you to configure log levels and opt to have log messages emailed to you. What does it mean to configure a “log level”? Log levels allow you to leave logging messages in your code rather than removing them when you are done debugging, and allows you to dynamically configure the verbosity of your application’s logging. When you insert a LOG4CF tag in your code, you assign it a log level. You can then dynamically turn on or off different log levels for each applications in the Log4CF manager to adjust the amount of logging each of your applications does depending on how closely you want to watch it.

Actually, my favorite thing about Log4CF is that it lets you put your log message in the body of the tag rather than as an attribute, so your messages can be as long and detailed as you want without making your code difficult to read.

One Response to Spotlight on Log4CF From DRK4

  1. Thanks for the info Christian. I’ll be sure to give it a try this weekend.