Blog

Tip of the Week: WireBox Debug Output

Brad Wood February 06, 2013

Spread the word

Brad Wood

February 06, 2013

Spread the word


Share your thoughts

 

If you've used WireBox for autowiring the CFCs in your application, you may have reached a point where you were having trouble figuring out what was going on behind the scenes.  This can be especially true if you've added auutowire metdata to a CFC, but the dependencies still aren't getting injected.
 
WireBox actually has pretty robust debug-level logging built in via LogBox that will tell you everything it is doing, but the question might be, "How do I see it?"  Wirebox's debug logging is kind of like the light in your fridge-- it's only on when you're looking at it.  
 
First, you need to have at least one LogBox appender enabled.  Depending on which application template you used, you may alread have a ColdboxTracerAppender appender configured which shows up when debug mode is on.  My favorite appender to set up an AsyncRollingFileAppender and then watch the text file with a tail program.
 
logBox = {
    appenders = {
        myAsycFile = {
            class="coldbox.system.logging.appenders.AsyncRollingFileAppender",
            properties={
                filePath=expandPath("/common/logs"),autoExpand=false
            }
        }
    }
};
 
Now, even if you already have an appender configured, you're probably not seeing any debug logs from WireBox; or any part of the ColdBox framework for that matter.  This is a good default, since ColdBox can be a bit chatty in debug mode.  The reason you're not seeing anything is because the "coldbox.system" category is turned off.  Remember that loggers in LogBox are named after the CFC they're in, and inherit logging settings in a hierarchical manner.  Look for a line of code similar to this in your config:
 
info = ["coldbox.system"]
 
This sets a maximum log level of "info" for anything logged inside of "coldbox.system".  Since all of WireBox's logs are debug level, they don't make the cut and get ignored.  To tell wirebox to start logging debug-level messages from WireBox, you can add the following line in the LogBox config:
 
debug = ["coldbox.system.ioc"]
 
After a quick reinit, LogBox will start logging debug messages from within coldbox.system.ioc (which is WireBox) to whatever appenders you have configured.  Don't forget to turn debug logs back off when you are done for performance reasons.  
 
 
P.S. You can also use environment overrides so debug messages are logged on your development machine, but not on higher environments. 

Add Your Comment

Recent Entries

Ortus June 2024 Newsletter!

Ortus June 2024 Newsletter!

Welcome to the latest edition of the Ortus Newsletter! This month, we're excited to bring you highlights from our sessions at CFCamp and Open South Code, as well as a sneak peek into our upcoming events. Discover the latest developments in BoxLang, our dynamic new JVM language, and catch up on all the insightful presentations by our expert team. Let's dive in!

Maria Jose Herrera
Maria Jose Herrera
June 28, 2024
BoxLang June 2024 Newsletter!

BoxLang June 2024 Newsletter!

We're thrilled to bring you the latest updates and exciting developments from the world of BoxLang. This month, we're diving into the newest beta release, introducing a new podcast series, showcasing innovative integrations, and sharing insights from recent events. Whether you're a seasoned developer or just getting started, there's something here for everyone to explore and enjoy.

Maria Jose Herrera
Maria Jose Herrera
June 28, 2024
BoxLang 1.0.0 Beta 3 Launched

BoxLang 1.0.0 Beta 3 Launched

We are thrilled to announce the release of BoxLang 1.0.0-Beta 3! This latest beta version is packed with exciting new features and essential bug fixes, including robust encryption functionality, enhanced Java interoperability, and more efficient event handling. Key highlights include the introduction of query caching capabilities, seamless coercion of Java Single Abstract Method (SAM) interfaces from BoxLang functions, and support for virtual thread executors. So, let’s dive into the details of what’s new in BoxLang 1.0.0-Beta 3 and how you can start leveraging these updates today!

Luis Majano
Luis Majano
June 28, 2024