LogBox Categories

Is it just me, or are categories defined in the config ignored in logbox.cfc’s configure method?

I’m using the DSL config, and my categories are making it into instance.categories of my logBoxConfig object, but when configure is called on init of logBox, the only logger initially created is the root logger.

I added a “registerCategory” method info logbox.cfc and changed the configure method to loop over all the keys in instance.config.getAllCategories() and call it. Now my “coldbox.system” category that I had created is getting picked up properly.

Let me know if I am just missing something or if this really was a bug. If it was the latter, I can post my code to save you some work.

Thanks!

~Brad

Bump?

~Brad

Brad, are you saying that the categories don’t work? I am not understading this? Also can you put your configuration DSL here so I can test with it.

If you are saying that category loggers are not created immediately you are right, because all of the category loggers are lazy loaded.

Luis F. Majano
President
Ortus Solutions, Corp

ColdBox Platform: http://www.coldbox.org
Linked In: http://www.linkedin.com/pub/3/731/483
Blog: http://www.luismajano.com
IECFUG Manager: http://www.iecfug.com

Brad, are you saying that the categories don’t work?

Yes, it appeared that the category I defined was not being used. I somehow missed line 211 of LogBox.cfc and didn’t realize that category loggers were lazy loaded. I undid any changes I had made to the LogBox file and steped through the code today and everything actually appears to be working fine now which is kind of weird. My category logger was meant to keep all the debug stuff from coldbox.system from being logged. My best guess is that when I was using the numeric equivialant of the log levels I inadvertandly had 4 in as my max log level as opposed to 3. I think I changed it to “INFO” about the time it started working.

So, I think we’re good to go on this one. We’ll chalk it up to misguided confusion on my part :slight_smile:

While I’m here talking about the DSL config, I have a quick question. On CF 8.0.1 the category DSL synax you used in the docs errors with “Invalid CFML construct found on line … ColdFusion was looking at the following text: {”

categories = {
“com.model.myservice” = {levelMax=“ERROR”,appenders=“MyTwit” }
}

To get it to work I set categories to {} and used a second statement below like so:

//LogBox DSL
logBox =
{
// Define Appenders
appenders = {
logFile = {
class = “coldbox.system.logging.appenders.AsyncFileAppender”,
properties = {
filepath = “D:\logs”,
autoExpand = false,
filename = “PageGeneratorAdmin”
}
}
},
// Root Logger
root = { appenders="*"},

categories = {}
};

logbox.categories[“coldbox.system”] = {levelMax=“INFO”, appenders=“logFile” };

Does the syntax in the docs work for anyone else on 8.0.1 or is this one of those differences between Railo and Adobe CF?

Thanks!

~Brad

I suspect that syntax only works on ColdFusion 9 / Railo and not on
ColdFusion 8.0.1. Struct literals were pretty broken in CF8/8.0.1 and
they've been fixed in CF9 - the specific case you have is quoted keys
which I'm pretty sure only started working in CF9?