RE: [coldbox:18102] [coldbox-3.5.2] Logbox Categories by RegEx

Note, that “LogBox” is a different object from a “logger”. LogBox is sort of the manager for the root logger and all the other name logger categories in your app. Right now you are injecting a logger. and Luis is suggesting that you inject the LogBox manager itself. It won’t exist yet when init() is run since that runs prior to autowire, but in the onDIComplete() method (which WireBox calls after injecting your stuff) you can do something like:

mySQLLogger = logbox.getLogger(“mySQLLogger”);

However, I’m not entirely sure this actually solves the original problem you are asking about since you didn’t want to have a statically named logger, but instead wanted to do this:

mySQLLogger = logbox.getLogger(this);

However, you appear to want a logging category that responds to all log severity, but only uses the SQL appender.

Logger categories inherit from themselves, i.e., if is undefined but is, will inherit the settings from So one thing to try would be to create a “SQL” logging category with the appenders you want and then get your logger like so:

mySQLLogger = logbox.getLogger(“SQL.” & getMetaData(this).name);
myRegularLogger = logbox.getLogger(this);

That would give you a logger called and one called If only the ROOT logger and the SQL logger were defined in the config, would inherit from ROOT, but would inherit from the SQL logger. ROOT would of course have all appenders, and SQL would only have the DB one you wanted.

AOP isn’t nearly as scary as it seems-- it’s just an abstract concept. Think of the “preEvent” and “postEvent” methods that run in your handler before and after every event. Imagine if you could do that for any method in your entire application but with more flexibility. You’d have to tell us more about how your SQL is organized (is it all in DAOs?) and what are you logging for us to give more guidance.

Don’t overlook a plain old interceptor for logging too. The advantage over that is you can supply the interceptor with whatever data you want from inside your method whereas an AOP advice can only see the incoming arguments and outgoing results, but the inside of the method call itself is a black box.

function DBStuff() {

var interceptData = juicyDetails;





ColdBox Platform Evangelist
Ortus Solutions, Corp

ColdBox Platform: