[Coldbox 4.x] - config logbox in module

What is the proper way to add/configure an appender and categories for a module? There does not seem to be a way to manipulate this inside the ModuleConfig.cfc? It’s easy to add datasources and interceptors and routes, etc. - basically appending to the Coldbox config settings - but there doesn’t seem to be a way to setup additional appenders/categories for logbox?

I see that you get a reference to logbox and logger, just not sure if/how they could be leveraged programmatically for this?.

For context, we log all login/logout info in various apps and wanted to move this functionality into its own module that could them be dropped into several apps. I’m certain I am missing something simple here so apologies in advance for what’s likely something simple I overlooked!

I think we need to improve how you add settings to logbox. It’s possible to do it programmatically, but it may not be obvious how to do it. Here’s an example that adds the tracer appender (which is defined in a module) to LogBox after all configuration (and modules) have been loaded. It should get you started. Check out the API docs for more methods.

https://github.com/ColdBox/coldbox-samples/blob/master/applications/helloworld/interceptors/LogBox.cfc

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

thx Brad. It appears the the getAppendersMap() method used in your example is now a private method. However, I changed it to public just to check and this does not seem to work.

I reviewed the API docs, etc. before posting. There are many functions that seem to be fitting (e.g. configure, etc.) but I believe I tried them all and they just doesn’t appear to work?

Ah yes, I remember needing to change that. It looks like that fix never actually made it into ColdBox though :confused:

We have our internal RoadBox meeting on Friday. I’ll bring this up. I think we should look in general and improving programmatic LogBox configuration.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Thanks - I look forward to hearing how that goes!

In the meantime though, I still think that I am doing something wrong? Even if I modify CB to make that method public (or hack my way around to getting the module’s logbog appender and categories into the logbox config) I still cannot seem to get logbox to recognize or “re-init” with those settings?

“RoadBox” - ha! I like that!