Almost every application needs logging. Instead of writing your own logic in cfml applications it is a lot easier to use Logbox. It is based on the concepts of the Apache Log4J library. Logbox makes it easy to log messages to a file, a database, email, sockets and many more destinations, and it even allows you to write your own code for special logging targets.

Logbox can be used standalone so you are not limited to coldbox applications. It is very flexible and you can create many different loggers. For so far the good news. The bad news? Well, it is not really really bad, but I think the logbox documentation is confusing in some places. I have been using Logbox for a very long time, but even though I can create my own code for logging I was always struggling to get it right, so every component was logging in the right places and at the desired logging level.
There is a lot of documentation for logbox and log4j but a non-native english speaker like me is missing a good starting point and an explanation of the basic components. So I decided to ask around in some slack channels and read some Logbox source code, so after 10+ years I finally took some time to investigate Logbox a bit better, so now I understand all details. I want to share this in a few posts. Topics I will address:

  • basic configuration : logbox, loggers, appenders, categories and severity levels.
  • how to extend logging capabilities by creating your own appender.
  • a very simple way to display all logging details in our applications.
  • some logging examples: audit logging of your database changes, condition logging of performance

So in my next post I will start with the basic concepts of Logbox