Configuring LogBox
LogBox comes pre-configured for operation with very basic logging. However, you can customize it to your fancy using different configuration strategies using the programmatic configuration object or the LogBox Config DSL.
When you are in a ColdBox application, you will have a logbox structure in your ColdBox.bx (or .cfc for CFML) already that you can use, or you can create a portable class as well and place it in config/LogBox.bx (or .cfc for CFML)
Configuration can be done in the following ways:
No configuration: Uses the default configuration shown below
Portable Class: Creating a portable data class using the LogBox DSL in a
configure()methodLogBoxConfig: Creating the
LogBoxConfigobject and interacting with its methods programmaticallyLogBox DSL Struct: Passing a struct literal into LogBox, using the LogBox DSL.
1. Default Configuration
This is the default configuration when LogBox is created with no config:
class {
/**
* Configure logBox
*/
function configure(){
logBox = {
// Define Appenders
appenders : {
console : { class : "ConsoleAppender" }
},
// Root Logger
root : {
levelmax : "INFO",
appenders : "*"
}
};
}
}
// Instantiate it
application.logbox = new logbox.system.logging.LogBox();2. Portable Class
You can create a class with a single configure method with the LogBox configuration in a variable called logbox using the LogBox DSL.
3. Programmatic LogBoxConfig
4. Struct Literal Config
Last updated
Was this helpful?